From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Patch to disable links line in *info* buffer Date: Tue, 11 Jun 2002 20:34:43 -0600 (MDT) Sender: emacs-devel-admin@gnu.org Message-ID: <200206120234.g5C2YhK04365@aztec.santafe.edu> References: <87bsaos1fl.fsf@orebokech.com> <200206072322.g57NMtK27277@aztec.santafe.edu> <5xbsam1tje.fsf@kfs2.cua.dk> <200206091518.g59FIuL00222@aztec.santafe.edu> <200206102343.g5ANhlv02332@aztec.santafe.edu> <87vg8qisfw.fsf@tc-1-100.kawasaki.gol.ne.jp> Reply-To: rms@gnu.org NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1023849390 5346 127.0.0.1 (12 Jun 2002 02:36:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 12 Jun 2002 02:36:30 +0000 (UTC) Cc: emacs-devel@gnu.org, bob@rattlesnake.com Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17Hxzp-0001O7-00 for ; Wed, 12 Jun 2002 04:36:29 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17HyNQ-0000Sk-00 for ; Wed, 12 Jun 2002 05:00:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17HxzY-0000gQ-00; Tue, 11 Jun 2002 22:36:12 -0400 Original-Received: from pele.santafe.edu ([192.12.12.119]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17Hxy9-0000V5-00; Tue, 11 Jun 2002 22:34:45 -0400 Original-Received: from aztec.santafe.edu (aztec [192.12.12.49]) by pele.santafe.edu (8.11.6+Sun/8.11.6) with ESMTP id g5C2YiQ17339; Tue, 11 Jun 2002 20:34:44 -0600 (MDT) Original-Received: (from rms@localhost) by aztec.santafe.edu (8.10.2+Sun/8.9.3) id g5C2YhK04365; Tue, 11 Jun 2002 20:34:43 -0600 (MDT) X-Authentication-Warning: aztec.santafe.edu: rms set sender to rms@aztec using -f Original-To: bob@rattlesnake.com In-Reply-To: (bob@rattlesnake.com) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:4775 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:4775 By the way, how do you fix an instance of a `plain vanilla' Emacs from the current CVS sources so that you can move around an Info file using the next, prev, and up key and mouse bindings? I think the change below should fix that. I also cleaned it up some, to make it easier to make other changes in handling the header line and the buffer's node line. There are some other undesirable things in this code. For instance, the items in the text line have a mouse-face that works, and only mouse-2 follows the link. But when in the header line, there is no mouse-face, and both mouse-1 and mouse-2 follow the link. The discrepancy between them seems ugly. If the links are hidden in the line in th ebufer, this discrepancy will go away. *** info.el.~1.304.~ Mon Jun 10 04:28:29 2002 --- info.el Tue Jun 11 21:02:20 2002 *************** *** 999,1005 **** (if Info-enable-active-nodes (eval active-expression)) (Info-fontify-node) (if Info-use-header-line ! (Info-setup-header-line) (setq Info-header-line nil) (setq header-line-format nil)) ; so the header line isn't displayed (run-hooks 'Info-selection-hook))))) --- 999,1012 ---- (if Info-enable-active-nodes (eval active-expression)) (Info-fontify-node) (if Info-use-header-line ! (progn ! (setq Info-header-line ! (get-text-property (point-min) 'header-line)) ! (setq header-line-format 'Info-header-line) ! ;;; It is useful to be able to copy the links line out of the buffer ! ;;; with M-w. ! ;;; (narrow-to-region (1+ header-end) (point-max)) ! ) (setq Info-header-line nil) (setq header-line-format nil)) ; so the header line isn't displayed (run-hooks 'Info-selection-hook))))) *************** *** 1016,1044 **** ") " (or Info-current-node "")))))) - ;; Skip the node header and make it into a header-line. This function - ;; should be called when the node is already narrowed. - (defun Info-setup-header-line () - (goto-char (point-min)) - (let* ((case-fold-search t) - (header-end (save-excursion (forward-line 1) (1- (point)))) - ;; If we find neither Next: nor Prev: link, show the entire - ;; node header. Otherwise, don't show the File: and Node: - ;; parts, to avoid wasting precious space on information that - ;; is available in the mode line. - (header-beg (if (re-search-forward - "\\(next\\|prev[ious]*\\): " - header-end t) - (match-beginning 1) - (point)))) - (set (make-local-variable 'Info-header-line) - (buffer-substring header-beg header-end)) - (setq header-line-format 'Info-header-line) - ;;; It is useful to be able to copy the links line out of the buffer - ;;; with M-w. - ;;; (narrow-to-region (1+ header-end) (point-max)) - )) - ;; Go to an info node specified with a filename-and-nodename string ;; of the sort that is found in pointers in nodes. --- 1023,1028 ---- *************** *** 2347,2352 **** --- 2331,2337 ---- (setq Info-tag-table-buffer nil) (make-local-variable 'Info-history) (make-local-variable 'Info-index-alternatives) + (make-local-variable 'Info-header-line) (set (make-local-variable 'tool-bar-map) info-tool-bar-map) ;; This is for the sake of the invisible text we use handling titles. (make-local-variable 'line-move-ignore-invisible) *************** *** 2601,2615 **** ;; Only fontify the node if it hasn't already been done. [We pass in ;; LIMIT arg to `next-property-change' because it seems to search past ;; (point-max).] ! (unless (and (< (next-property-change (point-min) nil (point-max)) ! (point-max)) ! ;; But do put the text properties if the local-map property ! ;; is inconsistent with Info-use-header-line's value. ! (eq ! (= (next-single-property-change ! (point-min) 'local-map nil (point-max)) ! (point-max)) ! (null Info-use-header-line))) (save-excursion (let ((buffer-read-only nil) (case-fold-search t)) --- 2586,2593 ---- ;; Only fontify the node if it hasn't already been done. [We pass in ;; LIMIT arg to `next-property-change' because it seems to search past ;; (point-max).] ! (unless (< (next-property-change (point-min) nil (point-max)) ! (point-max)) (save-excursion (let ((buffer-read-only nil) (case-fold-search t)) *************** *** 2630,2653 **** 'help-echo (concat "Go to node " (buffer-substring nbeg nend))) ! ;; Don't bind mouse events on the header line if we ! ;; aren't going to display the header line. ! (when Info-use-header-line ! (let ((fun (cdr (assoc tag '(("Prev" . Info-prev) ! ("Next" . Info-next) ! ("Up" . Info-up)))))) ! (when fun ! (let ((keymap (make-sparse-keymap))) ! (define-key keymap [header-line mouse-1] fun) ! (define-key keymap [header-line mouse-2] fun) ! (put-text-property tbeg nend 'local-map keymap))))) ! (if (not Info-use-header-line) ! ;; In case they switched Info-use-header-line off ! ;; in the middle of an Info session, some text ! ;; properties may have been left lying around from ! ;; past visits of this node. Remove them. ! (remove-text-properties tbeg nend '(local-map nil))) ! )))) (goto-char (point-min)) (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$" nil t) --- 2608,2641 ---- 'help-echo (concat "Go to node " (buffer-substring nbeg nend))) ! ;; Always set up the text property keymap. ! ;; It will be used either in the buffer ! ;; or copied in the header line. ! (let ((fun (cdr (assoc tag '(("Prev" . Info-prev) ! ("Next" . Info-next) ! ("Up" . Info-up)))))) ! (when fun ! (let ((keymap (make-sparse-keymap))) ! (define-key keymap [header-line mouse-1] fun) ! (define-key keymap [header-line mouse-2] fun) ! (define-key keymap [header-line down-mouse-1] 'ignore) ! (define-key keymap [mouse-2] fun) ! (put-text-property tbeg nend 'keymap keymap)))) ! ))) ! (goto-char (point-min)) ! (let* ((header-end (save-excursion (end-of-line) (point))) ! ;; If we find neither Next: nor Prev: link, show the entire ! ;; node header. Otherwise, don't show the File: and Node: ! ;; parts, to avoid wasting precious space on information that ! ;; is available in the mode line. ! (header-beg (if (re-search-forward ! "\\(next\\|prev[ious]*\\): " ! header-end t) ! (match-beginning 1) ! (point)))) ! (put-text-property (point-min) (1+ (point-min)) ! 'header-line ! (buffer-substring header-beg header-end)))) (goto-char (point-min)) (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$" nil t)