[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: breadcrumbs for Info . . . . . .
From: |
Stefan Monnier |
Subject: |
Re: breadcrumbs for Info . . . . . . |
Date: |
Thu, 12 Jun 2008 23:27:12 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
>> There is also another visual problem: when Info-hide-note-references
>> is nil, the displayed breadcrumbs line is not nice looking:
>>
>> *Note Top:: > *Note Files:: > *Note Saving:: > *Note Backup::
> That's a bug.
I'm not so sure. The same reasons that might push someone to want to
see "*Note <FOO>::" in the main text might push someone to want to see
them in the breadcrumbs. The reasons are typically the someone
unclea(r|n) behavior of invisible text when you move cursor around or
when you copy&paste it.
So if you want to trat it as a bug, a better fix would be to really
refrain from inserting "* Note <FOO>::" in the first place. I.e. use
a different buffer-text representation for your breadcrumbs. This may
not be very easy to do either because you then have to change all the
link-following code to deal with the new hyperlink format used in
the breadcrumbs.
I think it's a good feature, so I suggest you go back to the previous
version which didn't mess around with Info-hide-note-references, then
rework the code to stay with the 80-columns limit, and then someone can
maybe install it. I do worry about the (string= "Top" up) test: what
happens if your info file is slightly messed up and you never hit
a reference to "Top"?
Stefan
> I had tried to take care of that in the patch, but I missed some
> parts. Please try the attached patch, which should fix it.
> I also fixed an infinite recursion bug that occurred sometimes, due to
> Info-goto-node calling Info-fontify-node and (from the patch) vice versa.
> The change log remains the same.
> diff -u -w "info.el" "info-patched-2008-06-12.el"
> --- info.el 2008-06-10 16:24:28.000000000 -0700
> +++ info-patched-2008-06-12.el 2008-06-12 15:29:32.000000000 -0700
> @@ -3756,6 +3756,32 @@
> ((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))))))
> +
> + ;; Add breadcrumbs
> + (unless (string= "Top" Info-current-node)
> + (let ((nod Info-current-node)
> + (onode Info-current-node)
> + (crumbs nil)
> + (done nil))
> + (while (not done)
> + (let ((up (Info-extract-pointer "up")))
> + (cond ((string= "Top" up)
> + (setq crumbs (if crumbs
> + (concat "*Note Top:: > " crumbs)
> + "*Note Top::"))
> + (setq done t))
> + (t
> + (let ((Info-fontify-maximum-menu-size nil)) ;
> Prevents infinite recursion
> + (Info-goto-node up))
> + (setq nod Info-current-node)
> + (when crumbs (setq crumbs (concat " > " crumbs)))
> + (setq crumbs (concat "*Note " nod ":: " crumbs))))))
> + (let ((Info-fontify-maximum-menu-size nil)) ; Prevents infinite
> recursion
> + (Info-goto-node onode))
> + (forward-line 1)
> + (insert (concat crumbs "\n\n"))))
> +
> + ;; Treat header line
> (when Info-use-header-line
> (goto-char (point-min))
> (let* ((header-end (line-end-position))
> @@ -3817,13 +3843,15 @@
> ;; Fontify cross references
> (goto-char (point-min))
> (when (or not-fontified-p fontify-visited-p)
> - (while (re-search-forward "\\(\\*Note[ \n\t]+\\)\\([^:]*\\)\\(:[
> \t]*\\([^.,:(]*\\)\\(\\(([^)]*)\\)[^.,:]*\\)?[,:]?\n?\\)" nil t)
> + (while (re-search-forward "\\(\\*Note[ \n\t]+\\)\\([^:]*\\)\\(:[
> \t]*\
> +\\([^.,:(]*\\)\\(\\(([^)]*)\\)[^.,:]*\\)?[,:]?\n?\\)" nil t)
> (let ((start (match-beginning 0))
> (next (point))
> other-tag)
> (when not-fontified-p
> - (when Info-hide-note-references
> - (when (not (eq Info-hide-note-references 'hide))
> + (when (or Info-hide-note-references (<= (line-number-at-pos)
> 4))
> + (when (and (not (eq Info-hide-note-references 'hide))
> + (> (line-number-at-pos) 4)) ; Skip breadcrumbs
> ;; *Note is often used where *note should have been
> (goto-char start)
> (skip-syntax-backward " ")
> @@ -3913,11 +3941,14 @@
> (match-end 0)
> '(font-lock-face t))))))
> (when not-fontified-p
> - (when (memq Info-hide-note-references '(t hide))
> + (when (or (memq Info-hide-note-references '(t hide))
> + (<= (line-number-at-pos) 4))
> (add-text-properties (match-beginning 3) (match-end 3)
> '(invisible t front-sticky nil
> rear-nonsticky t))
> ;; Unhide the file name of the external reference in parens
> - (if (and (match-string 6) (not (eq Info-hide-note-references
> 'hide)))
> + (if (and (match-string 6)
> + (not (eq Info-hide-note-references 'hide))
> + (> (line-number-at-pos) 4))
> (remove-text-properties (match-beginning 6) (match-end 6)
> '(invisible t front-sticky nil
> rear-nonsticky t)))
> ;; Unhide newline because hidden newlines cause too long
> lines
> @@ -3932,7 +3963,9 @@
> (remove-text-properties (+ beg3 (match-beginning 0))
> (+ beg3 (match-end 0))
> '(invisible t front-sticky
> nil rear-nonsticky t))))))
> - (when (and Info-refill-paragraphs Info-hide-note-references)
> + (when (and Info-refill-paragraphs
> + (or Info-hide-note-references
> + (<= (line-number-at-pos) 4)))
> (push (set-marker (make-marker) start)
> paragraph-markers))))))
> @@ -4019,7 +4052,8 @@
> (setq hl (cdr hl))))
> res))) 'info-xref-visited 'info-xref)))
> (when (and not-fontified-p
> - (memq Info-hide-note-references '(t hide))
> + (or (memq Info-hide-note-references '(t hide))
> + (<= (line-number-at-pos) 4))
> (not (Info-index-node)))
> (put-text-property (match-beginning 2) (1- (match-end 6))
> 'invisible t)
> Diff finished at Thu Jun 12 15:34:19
- breadcrumbs for Info . . . . . ., Drew Adams, 2008/06/10
- Re: breadcrumbs for Info . . . . . ., Juri Linkov, 2008/06/10
- RE: breadcrumbs for Info . . . . . ., Drew Adams, 2008/06/10
- Re: breadcrumbs for Info . . . . . ., Juri Linkov, 2008/06/11
- RE: breadcrumbs for Info . . . . . ., Drew Adams, 2008/06/11
- Re: breadcrumbs for Info . . . . . ., Eli Zaretskii, 2008/06/11
- Re: breadcrumbs for Info . . . . . ., Juri Linkov, 2008/06/11
- Re: breadcrumbs for Info . . . . . ., Miles Bader, 2008/06/11
- RE: breadcrumbs for Info . . . . . ., Drew Adams, 2008/06/12
- Re: breadcrumbs for Info . . . . . .,
Stefan Monnier <=
- RE: breadcrumbs for Info . . . . . ., Drew Adams, 2008/06/13
- Re: breadcrumbs for Info . . . . . ., Thien-Thi Nguyen, 2008/06/13
- RE: breadcrumbs for Info . . . . . ., Drew Adams, 2008/06/13
- Re: breadcrumbs for Info . . . . . ., Thien-Thi Nguyen, 2008/06/13
- RE: breadcrumbs for Info . . . . . ., Drew Adams, 2008/06/13
- Re: breadcrumbs for Info . . . . . ., Thien-Thi Nguyen, 2008/06/13
- RE: breadcrumbs for Info . . . . . ., Drew Adams, 2008/06/13
- Re: breadcrumbs for Info . . . . . ., Juri Linkov, 2008/06/15
- Re: breadcrumbs for Info . . . . . ., Stefan Monnier, 2008/06/13
- RE: breadcrumbs for Info . . . . . ., Drew Adams, 2008/06/13