Thread View: gnu.epoch.misc
2 messages
2 total messages
Started by Brian L. Kahn
Wed, 17 Jun 1992 17:42
mouse bindings for info
Author: Brian L. Kahn
Date: Wed, 17 Jun 1992 17:42
Date: Wed, 17 Jun 1992 17:42
96 lines
3673 bytes
3673 bytes
There are other mouse bindings and enhancements for info mode. This
one works really well for me, and it has been stable for a while.
Basically, clicking with the middle button on a menu item or cross
reference takes you to that place. Clicking on one of the header
things (next, prev, up) takes you to the node.
---------snip snip-------------------
;;; info-mode mouse bindings for epoch
;;; Brian L. Kahn, blk@mitre.org, Tue Jun 9 12:53:52 1992
(defun Info-remove-cr (string)
"Replaces newline in STRING with a space."
(mapconcat
(function (lambda (x)
(char-to-string (if (char-equal x ?\n) ? x))))
string
""))
(defun x-Info-select (args)
"Selects menu item, follows *Note: reference, Up/Next/Prev/File."
(mouse::set-point args)
(cond ; check if line 1 or menu area or main text
((save-excursion (not (re-search-backward "$" nil t)))
;; we are on the first line
(if (not (re-search-backward "[, ] " nil t))
;; back up to last field or margin
(beginning-of-line))
;; onto field name
(re-search-forward "\\<" nil t)
(cond ((looking-at "Up") (Info-up))
((looking-at "Next") (Info-next))
((looking-at "Prev") (Info-prev))
((looking-at "Node") (Info-goto-node "Top"))
((looking-at "File") (Info-directory))
))
((save-excursion (re-search-backward "^\* Menu:" nil t))
;; we are in the menu area
(end-of-line) ; limit of node name search
(push-mark (point))
(re-search-backward "^\*")
(cond
((save-excursion (re-search-forward "::\\s-" (mark) 'no-err))
;; node name is first
(re-search-forward "^\\*\\s-*\\(.*\\)::\\s-" (mark))
)
((save-excursion (re-search-forward ":\\s-" (mark) 'no-err))
;; node name comes second
(re-search-forward ":\\s-*\\([^.]*\\)" (mark))
)
(t (error "Unrecognized menu format.")
))
(Info-goto-node
(buffer-substring (match-beginning 1) (match-end 1))
)
(pop-mark)
)
(t
;; in main text, look for footnote
(forward-word 1) ; in case mouse is on the word "*note"
(if (not (re-search-backward "\*note" nil t))
(error "Can't find a menu item or footnote."))
(forward-word 2)
(forward-word -1)
(re-search-forward "[^:]*" nil t)
(Info-follow-reference
(Info-remove-cr
(buffer-substring (match-beginning 0) (match-end 0)))))
))
;;; Info doesn't call an info mode hook - fix that!
(require 'info)
(defvar Info-mode-orig (symbol-function 'Info-mode))
(defun Info-mode ()
"Info mode with Info-mode-hook."
(funcall Info-mode-orig)
(run-hooks 'Info-mode-hook)
)
(setq Info-mode-hook
(function (lambda ()
(local-set-mouse mouse-middle mouse-down 'x-Info-select)
(local-set-mouse mouse-middle mouse-up ())
(message
"[middle]-Go to menu item, follow reference, File/Next/Prev/Up.")))
--
B< Brian Kahn blk@security.mitre.org "may the farce be with you"
Re: mouse bindings for info
Author: Brian L. Kahn
Date: Wed, 17 Jun 1992 23:10
Date: Wed, 17 Jun 1992 23:10
18 lines
1231 bytes
1231 bytes
Gosh darn it, that mouse bindings code got posted twice, each time
with a truncated line. The final function definition should be:
(setq Info-mode-hook
(function (lambda ()
(local-set-mouse mouse-middle mouse-down 'x-Info-select)
(local-set-mouse mouse-middle mouse-up ())
(message
"[middle]-Go to menu item, follow reference, File/Next/Prev/Up."))))
Sorry.
--
B< Brian Kahn blk@security.mitre.org "may the farce be with you"
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads