emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r108704: Fixes for Info link-followin


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108704: Fixes for Info link-following mouse commands.
Date: Sat, 23 Jun 2012 21:27:40 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108704
fixes bug: http://debbugs.gnu.org/11672
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2012-06-23 21:27:40 +0800
message:
  Fixes for Info link-following mouse commands.
  
  * lisp/info.el (Info-mouse-follow-link): Accept symbol values of the
  link-args property.  Select the window.
  (Info-fontify-node): Use Info-link-keymap for all navigation
  buttons, with link-args property to perform the desired action.
  (Info-link-keymap): Doc fix.
  (Info-next-link-keymap, Info-prev-link-keymap)
  (Info-up-link-keymap): Delete now-unused keymaps.
modified:
  lisp/ChangeLog
  lisp/info.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-06-23 12:48:24 +0000
+++ b/lisp/ChangeLog    2012-06-23 13:27:40 +0000
@@ -1,5 +1,15 @@
 2012-06-23  Chong Yidong  <address@hidden>
 
+       * info.el (Info-mouse-follow-link): Accept symbol values of the
+       link-args property.  Select the window (Bug#11672).
+       (Info-fontify-node): Use Info-link-keymap for all navigation
+       buttons, with link-args property to perform the desired action.
+       (Info-link-keymap): Doc fix.
+       (Info-next-link-keymap, Info-prev-link-keymap)
+       (Info-up-link-keymap): Delete now-unused keymaps.
+
+2012-06-23  Chong Yidong  <address@hidden>
+
        * mouse.el (mouse-drag-track): Deactivate the mark before popping.
 
        * progmodes/python.el (python-skeleton-define): Mark abbrevs as

=== modified file 'lisp/info.el'
--- a/lisp/info.el      2012-06-08 04:23:26 +0000
+++ b/lisp/info.el      2012-06-23 13:27:40 +0000
@@ -3695,12 +3695,20 @@
   (interactive "e")
   (let* ((position (event-start click))
         (posn-string (and position (posn-string position)))
-        (string (car-safe posn-string))
-        (string-pos (cdr-safe posn-string))
-        (link-args (and string string-pos
-                        (get-text-property string-pos 'link-args string))))
-    (when link-args
-      (Info-goto-node link-args))))
+        (link-args (if posn-string
+                       (get-text-property (cdr posn-string)
+                                          'link-args
+                                          (car posn-string))
+                     (get-char-property (posn-point position)
+                                        'link-args))))
+    (select-window (posn-window position))
+    (cond ((stringp link-args)
+          (Info-goto-node link-args))
+         ;; These special values of the `link-args' property are used
+         ;; for navigation; see `Info-fontify-node'.
+         ((eq link-args 'prev) (Info-prev))
+         ((eq link-args 'next) (Info-next))
+         ((eq link-args 'up)   (Info-up)))))
 
 
 (defvar Info-mode-map
@@ -4275,36 +4283,6 @@
          (t
           (Info-goto-emacs-command-node command)))))
 
-(defvar Info-next-link-keymap
-  (let ((keymap (make-sparse-keymap)))
-    (define-key keymap [header-line mouse-1] 'Info-next)
-    (define-key keymap [header-line mouse-2] 'Info-next)
-    (define-key keymap [header-line down-mouse-1] 'ignore)
-    (define-key keymap [mouse-2] 'Info-next)
-    (define-key keymap [follow-link] 'mouse-face)
-    keymap)
-  "Keymap to put on the Next link in the text or the header line.")
-
-(defvar Info-prev-link-keymap
-  (let ((keymap (make-sparse-keymap)))
-    (define-key keymap [header-line mouse-1] 'Info-prev)
-    (define-key keymap [header-line mouse-2] 'Info-prev)
-    (define-key keymap [header-line down-mouse-1] 'ignore)
-    (define-key keymap [mouse-2] 'Info-prev)
-    (define-key keymap [follow-link] 'mouse-face)
-    keymap)
-  "Keymap to put on the Prev link in the text or the header line.")
-
-(defvar Info-up-link-keymap
-  (let ((keymap (make-sparse-keymap)))
-    (define-key keymap [header-line mouse-1] 'Info-up)
-    (define-key keymap [header-line mouse-2] 'Info-up)
-    (define-key keymap [header-line down-mouse-1] 'ignore)
-    (define-key keymap [mouse-2] 'Info-up)
-    (define-key keymap [follow-link] 'mouse-face)
-    keymap)
-  "Keymap to put on the Up link in the text or the header line.")
-
 (defvar Info-link-keymap
   (let ((keymap (make-sparse-keymap)))
     (define-key keymap [header-line mouse-1] 'Info-mouse-follow-link)
@@ -4313,7 +4291,9 @@
     (define-key keymap [mouse-2] 'Info-mouse-follow-link)
     (define-key keymap [follow-link] 'mouse-face)
     keymap)
-  "Keymap to put on the link in the text or the header line.")
+  "Keymap to put on Info links.
+This is used for the \"Next\", \"Prev\", and \"Up\" links in the
+first line or header line, and for breadcrumb links.")
 
 (defun Info-breadcrumbs ()
   (let ((nodes (Info-toc-nodes Info-current-file))
@@ -4402,15 +4382,14 @@
                                  'help-echo
                                  (concat "mouse-2: Go to node "
                                          (buffer-substring nbeg nend)))
-              ;; Always set up the text property keymap.
-              ;; It will either be used in the buffer
-              ;; or copied in the header line.
-              (put-text-property
-              tbeg nend 'keymap
-              (cond
-               ((string-equal (downcase tag) "prev") Info-prev-link-keymap)
-               ((string-equal (downcase tag) "next") Info-next-link-keymap)
-               ((string-equal (downcase tag) "up"  ) Info-up-link-keymap))))))
+              ;; Set up the text property keymap.  Depending on
+              ;; `Info-use-header-line', it is either used in the
+              ;; buffer, or copied to the header line.  A symbol value
+              ;; of the `link-args' property is handled specially by
+              ;; `Info-mouse-follow-link'.
+              (put-text-property tbeg nend 'keymap Info-link-keymap)
+              (put-text-property tbeg nend 'link-args
+                                (intern (downcase tag))))))
 
         ;; (when (> Info-breadcrumbs-depth 0)
         ;;   (insert (Info-breadcrumbs)))


reply via email to

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