unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 'Juri Linkov' <juri@jurta.org>, emacs-devel@gnu.org
Subject: Re: breadcrumbs for Info . . . . . .
Date: Thu, 12 Jun 2008 23:27:12 -0400	[thread overview]
Message-ID: <jwvtzfygh1v.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <00a501c8ccdd$93328720$c2b22382@us.oracle.com> (Drew Adams's message of "Thu, 12 Jun 2008 15:42:20 -0700")

>> 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




  reply	other threads:[~2008-06-13  3:27 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-10 23:52 breadcrumbs for Info . . . . . Drew Adams
2008-06-11  0:04 ` Juri Linkov
2008-06-11  3:18   ` Drew Adams
2008-06-11  9:34     ` Juri Linkov
2008-06-11 13:46       ` Drew Adams
2008-06-11 18:59         ` Eli Zaretskii
2008-06-11 22:40         ` Juri Linkov
2008-06-12  2:01           ` Miles Bader
2008-06-12 22:42           ` Drew Adams
2008-06-13  3:27             ` Stefan Monnier [this message]
2008-06-13  6:34               ` Drew Adams
2008-06-13  8:43                 ` Thien-Thi Nguyen
2008-06-13 13:55                   ` Drew Adams
2008-06-13 17:17                     ` Thien-Thi Nguyen
2008-06-13 17:52                       ` Drew Adams
2008-06-13 19:55                         ` Thien-Thi Nguyen
2008-06-13 20:10                           ` Drew Adams
2008-06-15 18:19                           ` Juri Linkov
2008-06-13 14:05                   ` Stefan Monnier
2008-06-13 15:12                     ` Drew Adams
2008-06-13 17:16                       ` Stefan Monnier
2008-06-13 18:32                     ` Thien-Thi Nguyen
2008-06-14  9:47                       ` Eli Zaretskii
2008-06-14 10:01                         ` Thien-Thi Nguyen
2008-06-13 13:58                 ` Stefan Monnier
2008-06-13 15:11                   ` Drew Adams
2008-06-13 20:34                     ` Stefan Monnier
2008-06-13 22:11                       ` Drew Adams
2008-06-13 22:44                         ` Stefan Monnier
2008-06-14  9:45                           ` Drew Adams
2008-06-14 16:16                             ` Stefan Monnier
2008-06-14 17:24                               ` Drew Adams
2008-06-14 18:04                                 ` Stefan Monnier
2008-06-15  0:27                                 ` Juri Linkov
2008-06-15  7:33                                   ` Drew Adams
2008-06-15 18:23                                     ` Juri Linkov
2008-06-15 19:46                                       ` Drew Adams
2008-06-15  0:28                       ` Juri Linkov
2008-06-15  2:04                         ` Stefan Monnier
2008-06-15 18:18                           ` Juri Linkov
2008-06-15  7:55                         ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvtzfygh1v.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).