unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6206: 23.1; docstring info node links with newlines
@ 2010-05-18  0:46 Kevin Ryde
  2010-05-18  9:01 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Ryde @ 2010-05-18  0:46 UTC (permalink / raw)
  To: 6206

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

In a docstring has an info link with a newline in it like

(defun foo ()
  "Foo.
Info node `(emacs)File
Variables'."
  nil)

The link is buttonized by M-x describe-function, but pressing Ret on the
button gets an error

    No such node or anchor: File

The end of `gnus-level-unsubscribed' is an example of this -- though it
has a separate problem of needing the manual name `(gnus)Group Levels'.


2010-05-18  Kevin Ryde  <user42@zip.com.au>

	* help-mode.el (help-make-xrefs): For info node links turn
	newlines into spaces.  Link node names with newlines are matched
	by help-xref-info-regexp and buttonized, this change ensures they
	can be followed successfully with Ret.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: help-mode.el.info-link-newlines.diff --]
[-- Type: text/x-diff, Size: 648 bytes --]

--- help-mode.el.~1.71.~	2009-11-17 10:41:35.000000000 +1100
+++ help-mode.el	2010-05-18 10:39:27.000000000 +1000
@@ -433,7 +433,9 @@
                     (let ((data (match-string 2)))
                       (save-match-data
                         (unless (string-match "^([^)]+)" data)
-                          (setq data (concat "(emacs)" data))))
+                          (setq data (concat "(emacs)" data)))
+			(setq data ;; possible newlines if para filled
+			      (replace-regexp-in-string "\n" " " data t t)))
                       (help-xref-button 2 'help-info data))))
                 ;; URLs
                 (save-excursion

[-- Attachment #3: Type: text/plain, Size: 1076 bytes --]



In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
 of 2009-09-14 on raven, modified by Debian
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6206: 23.1; docstring info node links with newlines
  2010-05-18  0:46 bug#6206: 23.1; docstring info node links with newlines Kevin Ryde
@ 2010-05-18  9:01 ` Andreas Schwab
  2010-05-19 23:25   ` Kevin Ryde
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2010-05-18  9:01 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: 6206

Kevin Ryde <user42@zip.com.au> writes:

> --- help-mode.el.~1.71.~	2009-11-17 10:41:35.000000000 +1100
> +++ help-mode.el	2010-05-18 10:39:27.000000000 +1000
> @@ -433,7 +433,9 @@
>                      (let ((data (match-string 2)))
>                        (save-match-data
>                          (unless (string-match "^([^)]+)" data)
> -                          (setq data (concat "(emacs)" data))))
> +                          (setq data (concat "(emacs)" data)))
> +			(setq data ;; possible newlines if para filled
> +			      (replace-regexp-in-string "\n" " " data t t)))

Should this also handle indentation?  (Info generally does.)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6206: 23.1; docstring info node links with newlines
  2010-05-18  9:01 ` Andreas Schwab
@ 2010-05-19 23:25   ` Kevin Ryde
  2010-05-20 23:57     ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Ryde @ 2010-05-19 23:25 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 6206

Andreas Schwab <schwab@linux-m68k.org> writes:
>
> Should this also handle indentation?  (Info generally does.)

I suppose indentation would be unusual in a docstring, but it could be
worth letting anything help-xref-info-regexp matches work.  Perhaps runs
of whitespace,

    (replace-regexp-in-string "\\s-+" " " data t t)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6206: 23.1; docstring info node links with newlines
  2010-05-19 23:25   ` Kevin Ryde
@ 2010-05-20 23:57     ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2010-05-20 23:57 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: 6206-done, Andreas Schwab

>> Should this also handle indentation?  (Info generally does.)
>
> I suppose indentation would be unusual in a docstring, but it could be
> worth letting anything help-xref-info-regexp matches work.  Perhaps runs
> of whitespace,
>
>     (replace-regexp-in-string "\\s-+" " " data t t)

This doesn't work because `help-make-xrefs' uses
`emacs-lisp-mode-syntax-table' where \n is not whitespace.

You can try to eval in a buffer with emacs-lisp-mode:

  (replace-regexp-in-string "\\s-+" " " "(gnus)Group\nLevels" t t)
  => "(gnus)Group\nLevels"

So I installed your patch with "[ \t\n]+".

-- 
Juri Linkov
http://www.jurta.org/emacs/





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-20 23:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-18  0:46 bug#6206: 23.1; docstring info node links with newlines Kevin Ryde
2010-05-18  9:01 ` Andreas Schwab
2010-05-19 23:25   ` Kevin Ryde
2010-05-20 23:57     ` Juri Linkov

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