]> code.delx.au - gnu-emacs/commitdiff
* lisp/view.el (view--enable, view--disable): Rename from view-mode-enable
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 4 Jan 2013 02:53:48 +0000 (21:53 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 4 Jan 2013 02:53:48 +0000 (21:53 -0500)
and view-mode-disable and assume it's called from view-mode.
(view-mode-enable, view-mode-disable): Redefine as obsolete
compatibility layer above view-mode.
(view-mode-enter): Call `view-mode'.
* lisp/files.el (after-find-file): Call `view-mode'.

lisp/ChangeLog
lisp/files.el
lisp/view.el
src/ChangeLog
src/fns.c
test/indent/shell.sh

index fa2948569e1ebcf94f1b309d01317cf5b4293a24..6314c1218bb44bc922f973de5ffd67f076240227 100644 (file)
@@ -1,5 +1,13 @@
 2013-01-04  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * view.el (view--enable, view--disable): Rename from view-mode-enable
+       and view-mode-disable and assume it's called from view-mode.
+       (view-mode-enable, view-mode-disable): Redefine as obsolete
+       compatibility layer above view-mode.
+       (view-mode-enter): Call `view-mode'.
+
+       * files.el (after-find-file): Call `view-mode'.
+
        * doc-view.el (doc-view-scale-internally): New var.
        (doc-view-enlarge, doc-view-insert-image): Obey it.
 
        (lm-homepage): New function.
        (lm-with-file): Don't be confused if narrowing is in effect.
 
+2012-12-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
        * vc/diff-mode.el (diff-post-command-hook): Don't ignore changes at the
        very beginning of a hunk (e.g. killing the first line).
 
index 6a2945cbc797027189d6f06cdd2abbcd8c827bc3..ca5a415fb8ed4d984a8a8e8d60ad6e5977792cc7 100644 (file)
@@ -209,7 +209,6 @@ have fast storage with limited space, such as a RAM disk."
 (declare-function dired-unmark "dired" (arg))
 (declare-function dired-do-flagged-delete "dired" (&optional nomessage))
 (declare-function dos-8+3-filename "dos-fns" (filename))
-(declare-function view-mode-disable "view" ())
 (declare-function dosified-file-name "dos-fns" (file-name))
 
 (defvar file-name-invalid-regexp
@@ -2125,7 +2124,7 @@ unless NOMODES is non-nil."
     (setq buffer-read-only t))
   (unless nomodes
     (when (and view-read-only view-mode)
-      (view-mode-disable))
+      (view-mode -1))
     (normal-mode t)
     ;; If requested, add a newline at the end of the file.
     (and (memq require-final-newline '(visit visit-save))
index 5a28415ec7a2c8fa31b8570e2c8a8e7216b8bb6d..2717c915c71e6edbed7f9093f648ef75de81542b 100644 (file)
@@ -461,16 +461,13 @@ then \\[View-leave], \\[View-quit] and \\[View-kill-and-leave] will return to th
 
 Entry to view-mode runs the normal hook `view-mode-hook'."
   :lighter " View" :keymap view-mode-map
-  (if view-mode (view-mode-enable) (view-mode-disable)))
+  (if view-mode (view--enable) (view--disable)))
 \f
-(defun view-mode-enable (&optional run-view-mode-hook)
-  "Turn on View mode.
-Run `view-mode-hook' when RUN-VIEW-MODE-HOOK is non-nil."
+(defun view--enable ()
   ;; Always leave view mode before changing major mode.
   ;; This is to guarantee that the buffer-read-only variable is restored.
-  (add-hook 'change-major-mode-hook 'view-mode-disable nil t)
-  (setq view-mode t
-       view-page-size nil
+  (add-hook 'change-major-mode-hook 'view--disable nil t)
+  (setq view-page-size nil
        view-half-page-size nil
        view-old-buffer-read-only buffer-read-only
        buffer-read-only t)
@@ -481,16 +478,18 @@ Run `view-mode-hook' when RUN-VIEW-MODE-HOOK is non-nil."
            (format "continue viewing %s"
                    (if (buffer-file-name)
                        (file-name-nondirectory (buffer-file-name))
-                     (buffer-name)))))
-  (force-mode-line-update)
-  (when run-view-mode-hook
-    (run-hooks 'view-mode-hook)))
+                     (buffer-name))))))
 
+
+(define-obsolete-function-alias 'view-mode-enable 'view-mode "24.4")
 (defun view-mode-disable ()
   "Turn off View mode."
-  (remove-hook 'change-major-mode-hook 'view-mode-disable t)
+  (declare (obsolete view-mode "24.4"))
+  (view-mode -1))
+
+(defun view--disable ()
+  (remove-hook 'change-major-mode-hook 'view--disable t)
   (and view-overlay (delete-overlay view-overlay))
-  (force-mode-line-update)
   ;; Calling toggle-read-only while View mode is enabled
   ;; sets view-read-only to t as a buffer-local variable
   ;; after exiting View mode.  That arranges that the next toggle-read-only
@@ -499,7 +498,6 @@ Run `view-mode-hook' when RUN-VIEW-MODE-HOOK is non-nil."
   ;; so that View mode stays off if toggle-read-only is called.
   (if (local-variable-p 'view-read-only)
       (kill-local-variable 'view-read-only))
-  (setq view-mode nil)
   (if (boundp 'Helper-return-blurb)
       (setq Helper-return-blurb view-old-Helper-return-blurb))
   (if buffer-read-only
@@ -562,8 +560,7 @@ This function runs the normal hook `view-mode-hook'."
     (setq view-exit-action exit-action))
 
   (unless view-mode
-    (view-mode-enable t)
-    (force-mode-line-update)
+    (view-mode 1)
     (unless view-inhibit-help-message
       (message "%s"
               (substitute-command-keys "\
@@ -590,7 +587,7 @@ current buffer. "
   (when view-mode
     (let ((buffer (window-buffer)))
       (unless view-no-disable-on-exit
-       (view-mode-disable))
+       (view-mode -1))
 
       (unless exit-only
        (cond
@@ -601,8 +598,7 @@ current buffer. "
          (quit-window)))
 
        (when exit-action
-         (funcall exit-action buffer))
-       (force-mode-line-update)))))
+         (funcall exit-action buffer))))))
 \f
 (defun View-exit ()
   "Exit View mode but stay in current buffer."
index fa27e299ad7a76f708cf4f5f587191941242fe5c..5205ef4625ed07dedfbfd80a3c38986a914ff02f 100644 (file)
 
        * xdisp.c (select_frame_for_redisplay, ensure_selected_frame): Remove.
        (redisplay_internal): Don't bother selecting the frame to get the
-       proper value of frame-local variables.
+       proper value of frame-local variables (bug#13225).
 
 2012-12-20  Dmitry Antipov  <dmantipov@yandex.ru>
 
index 3beed018648bdee575e9867a472ff707ee93bdf2..687c3f6ff39fd6e1c8d57f4f17a480b959f61052 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -86,7 +86,7 @@ Other values of LIMIT are ignored.  */)
    before it's time to do a QUIT.  This must be a power of 2.  */
 enum { QUIT_COUNT_HEURISTIC = 1 << 16 };
 
-/* Random data-structure functions */
+/* Random data-structure functions */
 
 DEFUN ("length", Flength, Slength, 1, 1, 0,
        doc: /* Return the length of vector, list or string SEQUENCE.
index 6f3447c3aa943910dd12faecae71c5f5194814aa..790656501d1ceaa67af130a85bb8ee5527b5e3a1 100755 (executable)
@@ -5,6 +5,18 @@ setlock -n /tmp/getmail.lock && echo getmail isn\'t running
 
 # adsgsdg
 
+case $X in
+    foo)
+        do_something
+        ;;
+    arg=*)                     # bug#12953
+        do_something_else_based_on_arg
+        ;;
+    *)
+        default
+        ;;
+esac
+
 echo -n $(( 5 << 2 ))
 # This should not be treated as a heredoc (bug#12770).
 2