(define-ccl-program): Add `doc-string' declaration.
[bpt/emacs.git] / lisp / doc-view.el
index 7d2988f..3cf6d8c 100644 (file)
@@ -8,10 +8,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Requirements:
 
@@ -230,7 +228,7 @@ has finished."
   (let ((ol (image-mode-window-get 'overlay winprops)))
     (if ol
         (setq ol (copy-overlay ol))
-      (assert (not (get-char-property (point-min) 'display (car winprops))))
+      (assert (not (get-char-property (point-min) 'display)))
       (setq ol (make-overlay (point-min) (point-max) nil t))
       (overlay-put ol 'doc-view t))
     (overlay-put ol 'window (car winprops))
@@ -278,7 +276,7 @@ Can be `dvi', `pdf', or `ps'.")
 
 (defvar doc-view-mode-map
   (let ((map (make-sparse-keymap)))
-    (suppress-keymap map)
+    (set-keymap-parent map image-mode-map)
     ;; Navigation in the document
     (define-key map (kbd "n")         'doc-view-next-page)
     (define-key map (kbd "p")         'doc-view-previous-page)
@@ -291,13 +289,10 @@ Can be `dvi', `pdf', or `ps'.")
     (define-key map (kbd "M-<")       'doc-view-first-page)
     (define-key map (kbd "M->")       'doc-view-last-page)
     (define-key map [remap goto-line] 'doc-view-goto-page)
-    (define-key map [remap scroll-up] 'image-scroll-up)
-    (define-key map [remap scroll-down] 'image-scroll-down)
     ;; Zoom in/out.
     (define-key map "+"               'doc-view-enlarge)
     (define-key map "-"               'doc-view-shrink)
-    ;; Killing/burying the buffer (and the process)
-    (define-key map (kbd "q")         'bury-buffer)
+    ;; Killing the buffer (and the process)
     (define-key map (kbd "k")         'doc-view-kill-proc-and-buffer)
     (define-key map (kbd "K")         'doc-view-kill-proc)
     ;; Slicing the image
@@ -308,13 +303,6 @@ Can be `dvi', `pdf', or `ps'.")
     (define-key map (kbd "C-s")       'doc-view-search)
     (define-key map (kbd "<find>")    'doc-view-search)
     (define-key map (kbd "C-r")       'doc-view-search-backward)
-    ;; Scrolling
-    (define-key map [remap forward-char]  'image-forward-hscroll)
-    (define-key map [remap backward-char] 'image-backward-hscroll)
-    (define-key map [remap move-end-of-line]       'image-eol)
-    (define-key map [remap move-beginning-of-line] 'image-bol)
-    (define-key map [remap next-line]     'image-next-line)
-    (define-key map [remap previous-line] 'image-previous-line)
     ;; Show the tooltip
     (define-key map (kbd "C-t")       'doc-view-show-tooltip)
     ;; Toggle between text and image display or editing
@@ -845,16 +833,17 @@ have the page we want to view."
             (sort (directory-files (doc-view-current-cache-dir) t
                                    "page-[0-9]+\\.png" t)
                   'doc-view-sort))
-      (dolist (win (get-buffer-window-list buffer nil t))
-        (let* ((page (doc-view-current-page win))
-               (pagefile (expand-file-name (format "page-%d.png" page)
-                                             (doc-view-current-cache-dir))))
-          (when (or force
-                    (and (not (member pagefile prev-pages))
-                         (member pagefile doc-view-current-files)))
-            (with-selected-window win
-              (assert (eq (current-buffer) buffer))
-              (doc-view-goto-page page))))))))
+      (dolist (win (or (get-buffer-window-list buffer nil t)
+                      (list (selected-window))))
+       (let* ((page (doc-view-current-page win))
+              (pagefile (expand-file-name (format "page-%d.png" page)
+                                          (doc-view-current-cache-dir))))
+         (when (or force
+                   (and (not (member pagefile prev-pages))
+                        (member pagefile doc-view-current-files)))
+           (with-selected-window win
+             (assert (eq (current-buffer) buffer))
+             (doc-view-goto-page page))))))))
 
 (defun doc-view-buffer-message ()
   ;; Only show this message initially, not when refreshing the buffer (in which