diff options
| author | Chong Yidong | 2012-06-23 21:27:40 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-06-23 21:27:40 +0800 |
| commit | 136e1c1d50c2f7d857e37d07606a44c17954aaf6 (patch) | |
| tree | 6d59c177831dd1d14256af95a9c958fd5e1466de | |
| parent | 7af107c7a3a0ced7becbcf6ac2237a843fcd0b80 (diff) | |
| download | emacs-136e1c1d50c2f7d857e37d07606a44c17954aaf6.tar.gz emacs-136e1c1d50c2f7d857e37d07606a44c17954aaf6.zip | |
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.
Fixes: debbugs:11672
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/info.el | 71 |
2 files changed, 35 insertions, 46 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8b17b543315..122013463dc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,15 @@ | |||
| 1 | 2012-06-23 Chong Yidong <cyd@gnu.org> | 1 | 2012-06-23 Chong Yidong <cyd@gnu.org> |
| 2 | 2 | ||
| 3 | * info.el (Info-mouse-follow-link): Accept symbol values of the | ||
| 4 | link-args property. Select the window (Bug#11672). | ||
| 5 | (Info-fontify-node): Use Info-link-keymap for all navigation | ||
| 6 | buttons, with link-args property to perform the desired action. | ||
| 7 | (Info-link-keymap): Doc fix. | ||
| 8 | (Info-next-link-keymap, Info-prev-link-keymap) | ||
| 9 | (Info-up-link-keymap): Delete now-unused keymaps. | ||
| 10 | |||
| 11 | 2012-06-23 Chong Yidong <cyd@gnu.org> | ||
| 12 | |||
| 3 | * mouse.el (mouse-drag-track): Deactivate the mark before popping. | 13 | * mouse.el (mouse-drag-track): Deactivate the mark before popping. |
| 4 | 14 | ||
| 5 | * progmodes/python.el (python-skeleton-define): Mark abbrevs as | 15 | * progmodes/python.el (python-skeleton-define): Mark abbrevs as |
diff --git a/lisp/info.el b/lisp/info.el index 112c9068353..b3fb7917c7d 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -3695,12 +3695,20 @@ If FORK is non-nil, it is passed to `Info-goto-node'." | |||
| 3695 | (interactive "e") | 3695 | (interactive "e") |
| 3696 | (let* ((position (event-start click)) | 3696 | (let* ((position (event-start click)) |
| 3697 | (posn-string (and position (posn-string position))) | 3697 | (posn-string (and position (posn-string position))) |
| 3698 | (string (car-safe posn-string)) | 3698 | (link-args (if posn-string |
| 3699 | (string-pos (cdr-safe posn-string)) | 3699 | (get-text-property (cdr posn-string) |
| 3700 | (link-args (and string string-pos | 3700 | 'link-args |
| 3701 | (get-text-property string-pos 'link-args string)))) | 3701 | (car posn-string)) |
| 3702 | (when link-args | 3702 | (get-char-property (posn-point position) |
| 3703 | (Info-goto-node link-args)))) | 3703 | 'link-args)))) |
| 3704 | (select-window (posn-window position)) | ||
| 3705 | (cond ((stringp link-args) | ||
| 3706 | (Info-goto-node link-args)) | ||
| 3707 | ;; These special values of the `link-args' property are used | ||
| 3708 | ;; for navigation; see `Info-fontify-node'. | ||
| 3709 | ((eq link-args 'prev) (Info-prev)) | ||
| 3710 | ((eq link-args 'next) (Info-next)) | ||
| 3711 | ((eq link-args 'up) (Info-up))))) | ||
| 3704 | 3712 | ||
| 3705 | 3713 | ||
| 3706 | (defvar Info-mode-map | 3714 | (defvar Info-mode-map |
| @@ -4275,36 +4283,6 @@ the variable `Info-file-list-for-emacs'." | |||
| 4275 | (t | 4283 | (t |
| 4276 | (Info-goto-emacs-command-node command))))) | 4284 | (Info-goto-emacs-command-node command))))) |
| 4277 | 4285 | ||
| 4278 | (defvar Info-next-link-keymap | ||
| 4279 | (let ((keymap (make-sparse-keymap))) | ||
| 4280 | (define-key keymap [header-line mouse-1] 'Info-next) | ||
| 4281 | (define-key keymap [header-line mouse-2] 'Info-next) | ||
| 4282 | (define-key keymap [header-line down-mouse-1] 'ignore) | ||
| 4283 | (define-key keymap [mouse-2] 'Info-next) | ||
| 4284 | (define-key keymap [follow-link] 'mouse-face) | ||
| 4285 | keymap) | ||
| 4286 | "Keymap to put on the Next link in the text or the header line.") | ||
| 4287 | |||
| 4288 | (defvar Info-prev-link-keymap | ||
| 4289 | (let ((keymap (make-sparse-keymap))) | ||
| 4290 | (define-key keymap [header-line mouse-1] 'Info-prev) | ||
| 4291 | (define-key keymap [header-line mouse-2] 'Info-prev) | ||
| 4292 | (define-key keymap [header-line down-mouse-1] 'ignore) | ||
| 4293 | (define-key keymap [mouse-2] 'Info-prev) | ||
| 4294 | (define-key keymap [follow-link] 'mouse-face) | ||
| 4295 | keymap) | ||
| 4296 | "Keymap to put on the Prev link in the text or the header line.") | ||
| 4297 | |||
| 4298 | (defvar Info-up-link-keymap | ||
| 4299 | (let ((keymap (make-sparse-keymap))) | ||
| 4300 | (define-key keymap [header-line mouse-1] 'Info-up) | ||
| 4301 | (define-key keymap [header-line mouse-2] 'Info-up) | ||
| 4302 | (define-key keymap [header-line down-mouse-1] 'ignore) | ||
| 4303 | (define-key keymap [mouse-2] 'Info-up) | ||
| 4304 | (define-key keymap [follow-link] 'mouse-face) | ||
| 4305 | keymap) | ||
| 4306 | "Keymap to put on the Up link in the text or the header line.") | ||
| 4307 | |||
| 4308 | (defvar Info-link-keymap | 4286 | (defvar Info-link-keymap |
| 4309 | (let ((keymap (make-sparse-keymap))) | 4287 | (let ((keymap (make-sparse-keymap))) |
| 4310 | (define-key keymap [header-line mouse-1] 'Info-mouse-follow-link) | 4288 | (define-key keymap [header-line mouse-1] 'Info-mouse-follow-link) |
| @@ -4313,7 +4291,9 @@ the variable `Info-file-list-for-emacs'." | |||
| 4313 | (define-key keymap [mouse-2] 'Info-mouse-follow-link) | 4291 | (define-key keymap [mouse-2] 'Info-mouse-follow-link) |
| 4314 | (define-key keymap [follow-link] 'mouse-face) | 4292 | (define-key keymap [follow-link] 'mouse-face) |
| 4315 | keymap) | 4293 | keymap) |
| 4316 | "Keymap to put on the link in the text or the header line.") | 4294 | "Keymap to put on Info links. |
| 4295 | This is used for the \"Next\", \"Prev\", and \"Up\" links in the | ||
| 4296 | first line or header line, and for breadcrumb links.") | ||
| 4317 | 4297 | ||
| 4318 | (defun Info-breadcrumbs () | 4298 | (defun Info-breadcrumbs () |
| 4319 | (let ((nodes (Info-toc-nodes Info-current-file)) | 4299 | (let ((nodes (Info-toc-nodes Info-current-file)) |
| @@ -4402,15 +4382,14 @@ the variable `Info-file-list-for-emacs'." | |||
| 4402 | 'help-echo | 4382 | 'help-echo |
| 4403 | (concat "mouse-2: Go to node " | 4383 | (concat "mouse-2: Go to node " |
| 4404 | (buffer-substring nbeg nend))) | 4384 | (buffer-substring nbeg nend))) |
| 4405 | ;; Always set up the text property keymap. | 4385 | ;; Set up the text property keymap. Depending on |
| 4406 | ;; It will either be used in the buffer | 4386 | ;; `Info-use-header-line', it is either used in the |
| 4407 | ;; or copied in the header line. | 4387 | ;; buffer, or copied to the header line. A symbol value |
| 4408 | (put-text-property | 4388 | ;; of the `link-args' property is handled specially by |
| 4409 | tbeg nend 'keymap | 4389 | ;; `Info-mouse-follow-link'. |
| 4410 | (cond | 4390 | (put-text-property tbeg nend 'keymap Info-link-keymap) |
| 4411 | ((string-equal (downcase tag) "prev") Info-prev-link-keymap) | 4391 | (put-text-property tbeg nend 'link-args |
| 4412 | ((string-equal (downcase tag) "next") Info-next-link-keymap) | 4392 | (intern (downcase tag)))))) |
| 4413 | ((string-equal (downcase tag) "up" ) Info-up-link-keymap)))))) | ||
| 4414 | 4393 | ||
| 4415 | ;; (when (> Info-breadcrumbs-depth 0) | 4394 | ;; (when (> Info-breadcrumbs-depth 0) |
| 4416 | ;; (insert (Info-breadcrumbs))) | 4395 | ;; (insert (Info-breadcrumbs))) |