emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/view.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/view.el [lexbind]
Date: Tue, 14 Oct 2003 19:52:37 -0400

Index: emacs/lisp/view.el
diff -c emacs/lisp/view.el:1.64.4.1 emacs/lisp/view.el:1.64.4.2
*** emacs/lisp/view.el:1.64.4.1 Fri Apr  4 01:20:12 2003
--- emacs/lisp/view.el  Tue Oct 14 19:51:28 2003
***************
*** 43,49 ****
  ;;
  ;; You could also bind view-file, view-buffer, view-buffer-other-window and
  ;; view-buffer-other-frame to keys.
! 
  ;;; Code:
  
  (defgroup view nil
--- 43,49 ----
  ;;
  ;; You could also bind view-file, view-buffer, view-buffer-other-window and
  ;; view-buffer-other-frame to keys.
! 
  ;;; Code:
  
  (defgroup view nil
***************
*** 53,63 ****
    :group 'wp
    :group 'editing)
  
- (defcustom view-read-only nil
-   "*Non-nil means buffers visiting files read-only, do it in view mode."
-   :type 'boolean
-   :group 'view)
- 
  (defcustom view-highlight-face 'highlight
     "*The face used for highlighting the match found by View mode search."
     :type 'face
--- 53,58 ----
***************
*** 110,122 ****
    "Normal hook run when starting to view a buffer or file."
    :type 'hook
    :group 'view)
! 
  (defvar view-old-buffer-read-only nil)
  (make-variable-buffer-local 'view-old-buffer-read-only)
  
  (defvar view-old-Helper-return-blurb)
  (make-variable-buffer-local 'view-old-Helper-return-blurb)
  
  (defvar view-page-size nil
    "Default number of lines to scroll by View page commands.
  If nil then the local value of this is initially set to window size.")
--- 105,120 ----
    "Normal hook run when starting to view a buffer or file."
    :type 'hook
    :group 'view)
! 
  (defvar view-old-buffer-read-only nil)
  (make-variable-buffer-local 'view-old-buffer-read-only)
  
  (defvar view-old-Helper-return-blurb)
  (make-variable-buffer-local 'view-old-Helper-return-blurb)
  
+ ;; Just to avoid warnings.
+ (defvar Helper-return-blurb)
+ 
  (defvar view-page-size nil
    "Default number of lines to scroll by View page commands.
  If nil then the local value of this is initially set to window size.")
***************
*** 165,171 ****
                                'local-map mode-line-minor-mode-keymap
                                'help-echo "mouse-3: minor mode menu"))
              minor-mode-alist)))
! 
  ;; Define keymap inside defvar to make it easier to load changes.
  ;; Some redundant "less"-like key bindings below have been commented out.
  (defvar view-mode-map
--- 163,169 ----
                                'local-map mode-line-minor-mode-keymap
                                'help-echo "mouse-3: minor mode menu"))
              minor-mode-alist)))
! 
  ;; Define keymap inside defvar to make it easier to load changes.
  ;; Some redundant "less"-like key bindings below have been commented out.
  (defvar view-mode-map
***************
*** 230,236 ****
  (or (assq 'view-mode minor-mode-map-alist)
      (setq minor-mode-map-alist
          (cons (cons 'view-mode view-mode-map) minor-mode-map-alist)))
! 
  ;;; Commands that enter or exit view mode.
  
  ;;;###autoload
--- 228,234 ----
  (or (assq 'view-mode minor-mode-map-alist)
      (setq minor-mode-map-alist
          (cons (cons 'view-mode view-mode-map) minor-mode-map-alist)))
! 
  ;;; Commands that enter or exit view mode.
  
  ;;;###autoload
***************
*** 244,252 ****
  
  This command runs the normal hook `view-mode-hook'."
    (interactive "fView file: ")
!   (let ((had-a-buf (get-file-buffer file)))
!     (view-buffer (find-file-noselect file)
!                (and (not had-a-buf) 'kill-buffer))))
  
  ;;;###autoload
  (defun view-file-other-window (file)
--- 242,257 ----
  
  This command runs the normal hook `view-mode-hook'."
    (interactive "fView file: ")
!   (unless (file-exists-p file) (error "%s does not exist" file))
!   (let ((had-a-buf (get-file-buffer file))
!       (buffer (find-file-noselect file)))
!     (if (eq (with-current-buffer buffer
!             (get major-mode 'mode-class))
!           'special)
!       (progn
!         (switch-to-buffer buffer)
!         (message "Not using View mode because the major mode is special"))
!       (view-buffer buffer (and (not had-a-buf) 'kill-buffer)))))
  
  ;;;###autoload
  (defun view-file-other-window (file)
***************
*** 260,265 ****
--- 265,271 ----
  
  This command runs the normal hook `view-mode-hook'."
    (interactive "fIn other window view file: ")
+   (unless (file-exists-p file) (error "%s does not exist" file))
    (let ((had-a-buf (get-file-buffer file)))
      (view-buffer-other-window (find-file-noselect file) nil
                              (and (not had-a-buf) 'kill-buffer))))
***************
*** 276,281 ****
--- 282,288 ----
  
  This command runs the normal hook `view-mode-hook'."
    (interactive "fIn other frame view file: ")
+   (unless (file-exists-p file) (error "%s does not exist" file))
    (let ((had-a-buf (get-file-buffer file)))
      (view-buffer-other-frame (find-file-noselect file) nil
                             (and (not had-a-buf) 'kill-buffer))))
***************
*** 354,360 ****
      (switch-to-buffer-other-frame buffer)
      (view-mode-enter (and return-to (cons (selected-window) return-to))
                     exit-action)))
! 
  ;;;###autoload
  (defun view-mode (&optional arg)
    ;; In the following documentation string we have to use some explicit key
--- 361,367 ----
      (switch-to-buffer-other-frame buffer)
      (view-mode-enter (and return-to (cons (selected-window) return-to))
                     exit-action)))
! 
  ;;;###autoload
  (defun view-mode (&optional arg)
    ;; In the following documentation string we have to use some explicit key
***************
*** 438,444 ****
               (if (> (prefix-numeric-value arg) 0) view-mode (not view-mode)))
      (if view-mode (view-mode-disable)
        (view-mode-enable))))
! 
  (defun view-mode-enable ()
    "Turn on View mode."
    ;; Always leave view mode before changing major mode.
--- 445,451 ----
               (if (> (prefix-numeric-value arg) 0) view-mode (not view-mode)))
      (if view-mode (view-mode-disable)
        (view-mode-enable))))
! 
  (defun view-mode-enable ()
    "Turn on View mode."
    ;; Always leave view mode before changing major mode.
***************
*** 511,517 ****
      (message "%s"
             (substitute-command-keys "\
  View mode: type \\[help-command] for help, \\[describe-mode] for commands, 
\\[View-quit] to quit."))))
! 
  (defun view-mode-exit (&optional return-to-alist exit-action all-win)
    "Exit View mode in various ways, depending on optional arguments.
  RETURN-TO-ALIST, EXIT-ACTION and ALL-WIN determine what to do after exit.
--- 518,524 ----
      (message "%s"
             (substitute-command-keys "\
  View mode: type \\[help-command] for help, \\[describe-mode] for commands, 
\\[View-quit] to quit."))))
! 
  (defun view-mode-exit (&optional return-to-alist exit-action all-win)
    "Exit View mode in various ways, depending on optional arguments.
  RETURN-TO-ALIST, EXIT-ACTION and ALL-WIN determine what to do after exit.
***************
*** 596,602 ****
          (setq view-exit-action nil)
          (funcall exit-action buffer))
        (force-mode-line-update))))
! 
  (defun View-exit ()
    "Exit View mode but stay in current buffer."
    (interactive)
--- 603,609 ----
          (setq view-exit-action nil)
          (funcall exit-action buffer))
        (force-mode-line-update))))
! 
  (defun View-exit ()
    "Exit View mode but stay in current buffer."
    (interactive)
***************
*** 633,639 ****
    "Quit View mode, kill current buffer and return to previous buffer."
    (interactive)
    (view-mode-exit view-return-to-alist (or view-exit-action 'kill-buffer) t))
! 
  
  ;;; Some help routines.
  
--- 640,646 ----
    "Quit View mode, kill current buffer and return to previous buffer."
    (interactive)
    (view-mode-exit view-return-to-alist (or view-exit-action 'kill-buffer) t))
! 
  
  ;;; Some help routines.
  
***************
*** 710,723 ****
    (goto-line line)
    (view-recenter))
  
! (defun View-scroll-to-buffer-end ()
!   "Scroll backward or forward so that buffer end is at last line of window."
    (interactive)
!   (let ((p (if (pos-visible-in-window-p (point-max)) (point))))
!     (goto-char (point-max))
!     (recenter -1)
!     (and p (goto-char p))))
! 
  (defun view-scroll-lines (lines backward default maxdefault)
    ;; This function does the job for all the scrolling commands.
    ;; Scroll forward LINES lines.  If BACKWARD is true scroll backwards.
--- 717,732 ----
    (goto-line line)
    (view-recenter))
  
! (defun View-back-to-mark (&optional ignore)
!   "Return to last mark set in View mode, else beginning of file.
! Display that line at the center of the window.
! This command pops the mark ring, so that successive
! invocations return to earlier marks."
    (interactive)
!   (goto-char (or (mark t) (point-min)))
!   (pop-mark)
!   (view-recenter))
! 
  (defun view-scroll-lines (lines backward default maxdefault)
    ;; This function does the job for all the scrolling commands.
    ;; Scroll forward LINES lines.  If BACKWARD is true scroll backwards.
***************
*** 776,781 ****
--- 785,798 ----
                (if view-scroll-auto-exit "\\[View-scroll-page-forward]"
                  "\\[View-quit]")))
      (message "End of buffer")))
+ 
+ (defun View-scroll-to-buffer-end ()
+   "Scroll backward or forward so that buffer end is at last line of window."
+   (interactive)
+   (let ((p (if (pos-visible-in-window-p (point-max)) (point))))
+     (goto-char (point-max))
+     (recenter -1)
+     (and p (goto-char p))))
  
  (defun View-scroll-page-forward (&optional lines)
    "Scroll \"page size\" or prefix LINES lines forward in View mode.
***************
*** 856,872 ****
    (let ((view-scroll-auto-exit nil)
        (view-try-extend-at-buffer-end t))
      (view-scroll-lines lines nil view-page-size nil)))
! 
! (defun View-back-to-mark (&optional ignore)
!   "Return to last mark set in View mode, else beginning of file.
! Display that line at the center of the window.
! This command pops the mark ring, so that successive
! invocations return to earlier marks."
!   (interactive)
!   (goto-char (or (mark t) (point-min)))
!   (pop-mark)
!   (view-recenter))
! 
  (defun View-search-regexp-forward (n regexp)
    "Search forward for first (or prefix Nth) occurrence of REGEXP in View mode.
  
--- 873,879 ----
    (let ((view-scroll-auto-exit nil)
        (view-try-extend-at-buffer-end t))
      (view-scroll-lines lines nil view-page-size nil)))
! 
  (defun View-search-regexp-forward (n regexp)
    "Search forward for first (or prefix Nth) occurrence of REGEXP in View mode.
  
***************
*** 995,998 ****
--- 1002,1006 ----
  
  (provide 'view)
  
+ ;;; arch-tag: 6d0ace36-1d12-4de3-8de3-1fa3231636d7
  ;;; view.el ends here




reply via email to

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