emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch to disable links line in *info* buffer


From: Richard Stallman
Subject: Re: Patch to disable links line in *info* buffer
Date: Tue, 11 Jun 2002 20:34:43 -0600 (MDT)

    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)



reply via email to

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