emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108465: Make mode line help-echo


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108465: Make mode line help-echo visible for unibyte buffers.
Date: Fri, 02 Nov 2012 02:19:22 -0000
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108465
fixes bug: http://debbugs.gnu.org/11226
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2012-06-03 18:23:49 +0800
message:
  Make mode line help-echo visible for unibyte buffers.
  
  * src/xdisp.c (decode_mode_spec_coding): Display a space for a unibyte
  buffer.
  
  * lisp/bindings.el (mode-line-mule-info-help-echo)
  (mode-line-read-only-help-echo, mode-line-modified-help-echo):
  New functions.
  (mode-line-mule-info, mode-line-modified): Use them.
  (mode-line-eol-desc, propertized-buffer-identification):
  Consistency fixes for help text.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/bindings.el
  src/ChangeLog
  src/xdisp.c
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2012-06-01 18:26:21 +0000
+++ b/etc/NEWS  2012-06-03 10:23:49 +0000
@@ -87,6 +87,12 @@
 ** Using "unibyte: t" in Lisp source files is obsolete.
 Use "coding: raw-text" instead.
 
+** Mode line changes
+
+*** New option `mode-line-default-help-echo' specifies the help text
+(shown in a tooltip or in the echo area) for any part of the mode line
+that does not have its own specialized help text.
+
 
 * Editing Changes in Emacs 24.2
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-06-03 09:03:23 +0000
+++ b/lisp/ChangeLog    2012-06-03 10:23:49 +0000
@@ -7,6 +7,11 @@
        (mode-line-modes, mode-line-position): Move the default value to
        the variable definition.
        (mode-line-default-help-echo): New defcustom.
+       (mode-line-mule-info-help-echo, mode-line-read-only-help-echo)
+       (mode-line-modified-help-echo): New functions.
+       (mode-line-mule-info, mode-line-modified): Use them.
+       (mode-line-eol-desc, propertized-buffer-identification):
+       Consistency fixes for help text.
 
 2012-06-02  Stefan Monnier  <address@hidden>
 

=== modified file 'lisp/bindings.el'
--- a/lisp/bindings.el  2012-06-03 09:03:23 +0000
+++ b/lisp/bindings.el  2012-06-03 10:23:49 +0000
@@ -111,7 +111,7 @@
       (setq desc
            (propertize
             mnemonic
-            'help-echo (format "End-of-line style: %s\nmouse-1 to cycle"
+            'help-echo (format "End-of-line style: %s\nmouse-1: Cycle"
                                (if (eq eol 0) "Unix-style LF"
                                  (if (eq eol 1) "DOS-style CRLF"
                                    (if (eq eol 2) "Mac-style CR"
@@ -148,6 +148,16 @@
 is displayed first.")
 (put 'mode-line-front-space 'risky-local-variable t)
 
+(defun mode-line-mule-info-help-echo (window _object _point)
+  "Return help text specifying WINDOW's buffer coding system."
+  (with-current-buffer (window-buffer window)
+    (if buffer-file-coding-system
+       (format "Buffer coding system (%s): %s
+mouse-1: Describe coding system"
+               (if enable-multibyte-characters "multi-byte" "unibyte")
+               (symbol-name buffer-file-coding-system))
+      "Buffer coding system: none specified")))
+
 (defvar mode-line-mule-info
   `(""
     (current-input-method
@@ -162,31 +172,16 @@
                  mouse-face mode-line-highlight))
     ,(propertize
       "%z"
-      'help-echo
-      (lambda (window _object _point)
-       (with-current-buffer (window-buffer window)
-         ;; Don't show this tip if the coding system is nil,
-         ;; it reads like a bug, and is not useful anyway.
-         (when buffer-file-coding-system
-           (format "Buffer coding system %s\nmouse-1: describe coding system"
-                   (if enable-multibyte-characters
-                       (concat "(multi-byte): "
-                               (symbol-name buffer-file-coding-system))
-                     (concat "(unibyte): "
-                             (symbol-name buffer-file-coding-system)))))))
+      'help-echo 'mode-line-mule-info-help-echo
       'mouse-face 'mode-line-highlight
       'local-map mode-line-coding-system-map)
     (:eval (mode-line-eol-desc)))
-  "Mode line construct for displaying information of multilingual environment.
+  "Mode line construct to report the multilingual environment.
 Normally it displays current input method (if any activated) and
 mnemonics of the following coding systems:
   coding system for saving or writing the current buffer
-  coding system for keyboard input (if Emacs is running on terminal)
-  coding system for terminal output (if Emacs is running on terminal)"
-  ;; Currently not:
-  ;;  coding system for decoding output of buffer process (if any)
-  ;;  coding system for encoding text to send to buffer process (if any)."
-)
+  coding system for keyboard input (on a text terminal)
+  coding system for terminal output (on a text terminal)")
 ;;;###autoload
 (put 'mode-line-mule-info 'risky-local-variable t)
 (make-variable-buffer-local 'mode-line-mule-info)
@@ -199,29 +194,29 @@
 ;;;###autoload
 (put 'mode-line-client 'risky-local-variable t)
 
+(defun mode-line-read-only-help-echo (window _object _point)
+  "Return help text specifying WINDOW's buffer read-only status."
+  (format "Buffer is %s\nmouse-1: Toggle"
+         (if (buffer-local-value 'buffer-read-only (window-buffer window))
+             "read-only"
+           "writable")))
+
+(defun mode-line-modified-help-echo (window _object _point)
+  "Return help text specifying WINDOW's buffer modification status."
+  (format "Buffer is %smodified\nmouse-1: Toggle modification state"
+         (if (buffer-modified-p (window-buffer window)) "" "not ")))
+
 (defvar mode-line-modified
   (list (propertize
         "%1*"
-        'help-echo (purecopy (lambda (window _object _point)
-                               (format "Buffer is %s\nmouse-1 toggles"
-                                       (save-selected-window
-                                         (select-window window)
-                                         (if buffer-read-only
-                                             "read-only"
-                                           "writable")))))
+        'help-echo 'mode-line-read-only-help-echo
         'local-map (purecopy (make-mode-line-mouse-map
                               'mouse-1
                               #'mode-line-toggle-read-only))
         'mouse-face 'mode-line-highlight)
        (propertize
         "%1+"
-        'help-echo  (purecopy (lambda (window _object _point)
-                                (format "Buffer is %sodified\nmouse-1 toggles 
modified state"
-                                        (save-selected-window
-                                          (select-window window)
-                                          (if (buffer-modified-p)
-                                            "m"
-                                          "not m")))))
+        'help-echo 'mode-line-modified-help-echo
         'local-map (purecopy (make-mode-line-mouse-map
                               'mouse-1 #'mode-line-toggle-modified))
         'mouse-face 'mode-line-highlight))
@@ -312,7 +307,7 @@
 mouse-2: Show help for minor mode\n\
 mouse-3: Toggle minor modes"
                        local-map ,mode-line-minor-mode-keymap)
-         (propertize "%n" 'help-echo "mouse-2: Remove narrowing from the 
current buffer"
+         (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer"
                      'mouse-face 'mode-line-highlight
                      'local-map (make-mode-line-mouse-map
                                  'mouse-2 #'mode-line-widen))
@@ -401,9 +396,8 @@
   (list (propertize fmt
                    'face 'mode-line-buffer-id
                    'help-echo
-                   (purecopy "Buffer name\n\
-mouse-1: previous buffer\n\
-mouse-3: next buffer")
+                   (purecopy "Buffer name
+mouse-1: Previous buffer\nmouse-3: Next buffer")
                    'mouse-face 'mode-line-highlight
                    'local-map mode-line-buffer-identification-keymap)))
 

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-06-03 09:03:23 +0000
+++ b/src/ChangeLog     2012-06-03 10:23:49 +0000
@@ -1,5 +1,10 @@
 2012-06-03  Chong Yidong  <address@hidden>
 
+       * xdisp.c (decode_mode_spec_coding): Display a space for a unibyte
+       buffer (Bug#11226).
+
+2012-06-03  Chong Yidong  <address@hidden>
+
        * xdisp.c (calc_pixel_width_or_height): Use Fbuffer_local_value.
        (note_mode_line_or_margin_highlight): If there is no help echo,
        use mode-line-default-help-echo.  Handle the case where the mouse

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-06-03 09:59:00 +0000
+++ b/src/xdisp.c       2012-06-03 10:23:49 +0000
@@ -21012,8 +21012,7 @@
 
   if (!VECTORP (val))          /* Not yet decided.  */
     {
-      if (multibyte)
-       *buf++ = '-';
+      *buf++ = multibyte ? '-' : ' ';
       if (eol_flag)
        eoltype = eol_mnemonic_undecided;
       /* Don't mention EOL conversion if it isn't decided.  */
@@ -21026,8 +21025,9 @@
       attrs = AREF (val, 0);
       eolvalue = AREF (val, 2);
 
-      if (multibyte)
-       *buf++ = XFASTINT (CODING_ATTR_MNEMONIC (attrs));
+      *buf++ = multibyte
+       ? XFASTINT (CODING_ATTR_MNEMONIC (attrs))
+       : ' ';
 
       if (eol_flag)
        {


reply via email to

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