emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog doc-view.el


From: Tassilo Horn
Subject: [Emacs-diffs] emacs/lisp ChangeLog doc-view.el
Date: Tue, 27 Jan 2009 15:52:19 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Tassilo Horn <tsdh>     09/01/27 15:52:19

Modified files:
        lisp           : ChangeLog doc-view.el 

Log message:
        (doc-view-mode): Enhance docstring and fallback to
        fundamental-mode or ps-mode if the file is empty or doesn't exist
        at all.
        (doc-view-initiate-display): Better info message if doc-view-mode
        cannot be used.  (Missing utility or no png support/no X frame.)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15188&r2=1.15189
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/doc-view.el?cvsroot=emacs&r1=1.77&r2=1.78

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15188
retrieving revision 1.15189
diff -u -b -r1.15188 -r1.15189
--- ChangeLog   27 Jan 2009 08:29:35 -0000      1.15188
+++ ChangeLog   27 Jan 2009 15:52:17 -0000      1.15189
@@ -1,3 +1,11 @@
+2009-01-27  Tassilo Horn  <address@hidden>
+
+       * doc-view.el (doc-view-mode): Enhance docstring and fallback to
+       fundamental-mode or ps-mode if the file is empty or doesn't exist
+       at all.
+       (doc-view-initiate-display): Better info message if doc-view-mode
+       cannot be used.  (Missing utility or no png support/no X frame.)
+
 2009-01-27  Glenn Morris  <address@hidden>
 
        * mail/rmail.el (rmail-copy-headers): Doc fix.  Leave point at the end

Index: doc-view.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/doc-view.el,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- doc-view.el 5 Jan 2009 03:18:55 -0000       1.77
+++ doc-view.el 27 Jan 2009 15:52:18 -0000      1.78
@@ -1049,10 +1049,14 @@
     (message
      "%s"
      (substitute-command-keys
-      (concat "No image (png) support available or some conversion utility for 
"
+      (concat "No PNG support available or some conversion utility for "
              (file-name-extension doc-view-buffer-file-name)" files is 
missing.  "
-             "Type \\[doc-view-toggle-display] to switch to an editing mode or 
"
-             "\\[doc-view-open-text] to open a buffer showing the doc as 
text.")))))
+             "Type \\[doc-view-toggle-display] to switch to "
+             (if (eq doc-view-doc-type 'ps)
+                 "ps-mode"
+               "fundamental-mode")
+             ", \\[doc-view-open-text] to show the doc as text in a separate 
buffer "
+             " or \\[doc-view-kill-proc-and-buffer] to kill this buffer.")))))
 
 (defvar bookmark-make-record-function)
 
@@ -1078,11 +1082,23 @@
 ;;;###autoload
 (defun doc-view-mode ()
   "Major mode in DocView buffers.
+
+DocView Mode is an Emacs document viewer.  It displays PDF, PS
+and DVI files (as PNG images) in Emacs buffers.
+
 You can use \\<doc-view-mode-map>\\[doc-view-toggle-display] to
 toggle between displaying the document or editing it as text.
 \\{doc-view-mode-map}"
   (interactive)
 
+  (if (or (not (file-exists-p buffer-file-name))
+         (= (point-min) (point-max)))
+      ;; The doc is empty or doesn't exist at all, so fallback to an
+      ;; editing mode.
+      (if (string-match "[eE]?[pP][sS]" (file-name-extension buffer-file-name) 
"")
+         (ps-mode)
+       (fundamental-mode)) ;;Should we activate d-v-minor-mode here?
+
   (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode)
                              doc-view-previous-major-mode
                            major-mode)))
@@ -1144,8 +1160,8 @@
   (add-hook 'kill-buffer-hook 'doc-view-kill-proc nil t)
 
   (remove-overlays (point-min) (point-max) 'doc-view t) ;Just in case.
-  ;; Keep track of display info ([vh]scroll, page number, overlay, ...)
-  ;; for each window in which this document is shown.
+    ;; Keep track of display info ([vh]scroll, page number, overlay,
+    ;; ...)  for each window in which this document is shown.
   (add-hook 'image-mode-new-window-functions
             'doc-view-new-window-function nil t)
   (image-mode-setup-winprops)
@@ -1164,7 +1180,7 @@
        buffer-read-only t
        major-mode 'doc-view-mode)
   (doc-view-initiate-display)
-  (run-mode-hooks 'doc-view-mode-hook))
+    (run-mode-hooks 'doc-view-mode-hook)))
 
 ;;;###autoload
 (define-minor-mode doc-view-minor-mode




reply via email to

[Prev in Thread] Current Thread [Next in Thread]