unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19900: 24.4; info-look.el quotes from makeinfo @item
@ 2015-02-19  5:40 Kevin Ryde
  2015-02-19  6:11 ` Eli Zaretskii
  2015-03-13 18:17 ` Paul Eggert
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Ryde @ 2015-02-19  5:40 UTC (permalink / raw)
  To: 19900

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

Tags: patch

Recent makeinfo on @item generates forward quote 'foo' rather than
backquote `foo' which it used to.  info-look.el doesn't match the
forward 'foo' in various places which are @table (as opposed to @defun
etc).  For example with the glibc manual,

    M-x c-mode
    DBL_MAX          # type this
    C-h S            # and look it up
    =>
    goes to "Floating Point Parameters" node,
    but does not go down to the DBL_MAX entry

I suggest adding ' to the prefix regexps of relevant doc specs.

The latex-mode bit is a further small change to its suffix to match
\frac and \sqrt of the latex2e.info.

2015-02-19  Kevin Ryde  <user42_kevin@yahoo.com.au>

	* info-look.el (c-mode, bison-mode, makefile-mode)
	(makefile-automake-mode, texinfo-mode, autoconf-mode, awk-mode)
	(latex-mode, emacs-lisp-mode, sh-mode, cfengine-mode): Match both
	`foo' and 'foo' for @item and similar.
	(emacs-lisp-mode): U+2018,U+2019 in emacs.info and elisp.info too.
	(latex-mode): Match multi-arg \frac{num}{den} or \sqrt[root]{n} in
	suffix regexp


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: info-look.el.diff --]
[-- Type: text/x-diff, Size: 5782 bytes --]

--- info-look.el.orig	2015-02-15 09:09:49.433538275 +1100
+++ info-look.el	2015-02-19 16:33:54.393204587 +1100
@@ -704,6 +704,11 @@
 \f
 ;;; Initialize some common modes.
 
+;; Past makeinfo generated backquote `foo' for @item, where now circa
+;; version 5.2 it generates 'foo'.  Doc specs with patterns to match items
+;; like that (and sometimes within text from @code) have [`'] to work any
+;; .info files.
+
 (info-lookup-maybe-add-help
  :mode 'c-mode :topic 'symbol
  :regexp "\\(struct \\|union \\|enum \\)?[_a-zA-Z][_a-zA-Z0-9]*"
@@ -716,12 +721,12 @@
              ;; suffix "\\>" is not used because that sends DBL_MAX to
              ;; DBL_MAX_EXP ("_" is a non-word char)
 	     ("(libc)Variable Index" nil
-              "^\\([ \t]+-+ \\(Variable\\|Macro\\): .*\\<\\|`\\)"
+              "^\\([ \t]+-+ \\(Variable\\|Macro\\): .*\\<\\|[`']\\)"
               "\\( \\|'?$\\)")
 	     ("(libc)Type Index" nil
 	      "^[ \t]+-+ Data Type: \\<" "\\>")
 	     ("(termcap)Var Index" nil
-	      "^[ \t]*`" "'"))
+	      "^[ \t]*[`']" "'"))
  :parse-rule 'info-lookup-guess-c-symbol)
 
 (info-lookup-maybe-add-help
@@ -733,7 +738,7 @@
  :mode 'bison-mode
  :regexp "[:;|]\\|%\\([%{}]\\|[_a-z]+\\)\\|YY[_A-Z]+\\|yy[_a-z]+"
  :doc-spec '(("(bison)Index" nil
-	      "`" "'"))
+	      "[`']" "'"))
  :parse-rule "[:;|]\\|%\\([%{}]\\|[_a-zA-Z][_a-zA-Z0-9]*\\)"
  :other-modes '(c-mode))
 
@@ -741,7 +746,7 @@
  :mode 'makefile-mode
  :regexp "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*"
  :doc-spec '(("(make)Name Index" nil
-	      "^[ \t]*`" "'"))
+	      "^[ \t]*[`']" "'"))
  :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+")
 
 (info-lookup-maybe-add-help
@@ -756,15 +761,15 @@
  :doc-spec   '(
                ;; "(automake)Macro Index" is autoconf macros used in
                ;; configure.ac, not Makefile.am, so don't have that here.
-               ("(automake)Variable Index" nil "^[ \t]*`" "'")
+               ("(automake)Variable Index" nil "^[ \t]*[`']" "'")
                ;; In automake 1.4 macros and variables were a combined node.
-               ("(automake)Macro and Variable Index" nil "^[ \t]*`" "'")
+               ("(automake)Macro and Variable Index" nil "^[ \t]*[`']" "'")
                ;; Directives like "if" are in the "General Index".
                ;; Prefix "`" since the text for say `+=' isn't always an
                ;; @item etc and so not always at the start of a line.
-               ("(automake)General Index" nil "`" "'")
+               ("(automake)General Index" nil "[`']" "'")
                ;; In automake 1.3 there was just a single "Index" node.
-               ("(automake)Index" nil "`" "'"))
+               ("(automake)Index" nil "[`']" "'"))
  :other-modes '(makefile-mode))
 
 (info-lookup-maybe-add-help
@@ -775,7 +780,7 @@
 	      (lambda (item)
 		(if (string-match "^\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\( .*\\)?$" item)
 		    (concat "@" (match-string 1 item))))
-	      "`" "[' ]")))
+	      "[`']" "[' ]")))
 
 (info-lookup-maybe-add-help
  :mode 'm4-mode
@@ -821,7 +826,7 @@
 	     ;; macros (eg. AC_PROG_CC).  Ensure this is after the autoconf
 	     ;; index, so as to prefer the autoconf docs.
 	     ("(automake)Macro and Variable Index" nil
-	      "^[ \t]*`" "'"))
+	      "^[ \t]*[`']" "'"))
  ;; Autoconf symbols are M4 macros.  Thus use M4's parser.
  :parse-rule 'ignore
  :other-modes '(m4-mode))
@@ -846,7 +851,7 @@
 		   ;; Built-in functions (matches to many entries).
 		   ((string-match "^[a-z]+$" item)
 		    item))))
-	      "`" "\\([ \t]*([^)]*)\\)?'")))
+	      "[`']" "\\([ \t]*([^)]*)\\)?'")))
 
 (info-lookup-maybe-add-help
  :mode 'perl-mode
@@ -885,16 +890,18 @@
 		   ;; From http://home.gna.org/latexrefman
 		   "(latex2e)Command Index"
 		 "(latex)Command Index")
-	      nil "`" "\\({[^}]*}\\)?'")))
+              ;; \frac{NUM}{DEN} etc can have more than one {xx} argument.
+              ;; \sqrt[ROOT]{num} and others can have square brackets.
+	      nil "[`']" "\\({[^}]*}|\\[[^]]*\\]\\)*'")))
 
 (info-lookup-maybe-add-help
  :mode 'emacs-lisp-mode
  :regexp "[^][()`',\" \t\n]+"
  :doc-spec '(;; Commands with key sequences appear in nodes as `foo' and
              ;; those without as `M-x foo'.
-             ("(emacs)Command Index"  nil "`\\(M-x[ \t\n]+\\)?" "'")
+             ("(emacs)Command Index"  nil "[`'\u2018]\\(M-x[ \t\n]+\\)?" "['\u2019]")
              ;; Variables normally appear in nodes as just `foo'.
-             ("(emacs)Variable Index" nil "`" "'")
+             ("(emacs)Variable Index" nil "[`'\u2018]" "['\u2019]")
              ;; Almost all functions, variables, etc appear in nodes as
              ;; " -- Function: foo" etc.  A small number of aliases and
              ;; symbols appear only as `foo', and will miss out on exact
@@ -976,9 +983,9 @@
  ;; bash has "." and ":" in its index, but those chars will probably never
  ;; work in info, so don't bother matching them in the regexp.
  :regexp "\\([a-zA-Z0-9_-]+\\|[!{}@*#?$]\\|\\[\\[?\\|]]?\\)"
- :doc-spec '(("(bash)Builtin Index"       nil "^`" "[ .']")
-             ("(bash)Reserved Word Index" nil "^`" "[ .']")
-             ("(bash)Variable Index"      nil "^`" "[ .']")
+ :doc-spec '(("(bash)Builtin Index"       nil "^[`']" "[ .']")
+             ("(bash)Reserved Word Index" nil "^[`']" "[ .']")
+             ("(bash)Variable Index"      nil "^[`']" "[ .']")
 
              ;; coreutils (version 4.5.10) doesn't have a separate program
              ;; index, so exclude extraneous stuff (most of it) by demanding
@@ -1026,7 +1033,7 @@
 		  item))
 	      ;; This gets functions in evaluated classes.  Other
 	      ;; possible patterns don't seem to work too well.
-	      "`" "(")))
+	      "[`']" "(")))
 
 (info-lookup-maybe-add-help
  :mode 'Custom-mode

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




In GNU Emacs 24.4.1 (i586-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2014-12-20 on brahms, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
Configured using:
 `configure --build i586-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build i586-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=lucid --with-toolkit-scroll-bars
 --without-gconf --without-gsettings 'CFLAGS=-g -O2
 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
 CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-z,relro'

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

* bug#19900: 24.4; info-look.el quotes from makeinfo @item
  2015-02-19  5:40 bug#19900: 24.4; info-look.el quotes from makeinfo @item Kevin Ryde
@ 2015-02-19  6:11 ` Eli Zaretskii
  2015-03-13 18:17 ` Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2015-02-19  6:11 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: 19900

> From: Kevin Ryde <user42_kevin@yahoo.com.au>
> Date: Thu, 19 Feb 2015 16:40:47 +1100
> 
> Recent makeinfo on @item generates forward quote 'foo' rather than
> backquote `foo' which it used to.  info-look.el doesn't match the
> forward 'foo' in various places which are @table (as opposed to @defun
> etc).

These two characters are actually customizable in the latest Texinfo
(although I doubt that many people use that feature).  So perhaps
there should be a defcustom for them, so users could use other
characters if needed.

> 2015-02-19  Kevin Ryde  <user42_kevin@yahoo.com.au>
> 
> 	* info-look.el (c-mode, bison-mode, makefile-mode)
> 	(makefile-automake-mode, texinfo-mode, autoconf-mode, awk-mode)
> 	(latex-mode, emacs-lisp-mode, sh-mode, cfengine-mode): Match both
> 	`foo' and 'foo' for @item and similar.
> 	(emacs-lisp-mode): U+2018,U+2019 in emacs.info and elisp.info too.
> 	(latex-mode): Match multi-arg \frac{num}{den} or \sqrt[root]{n} in
> 	suffix regexp

Why do you confine U+2018 and U+2019 to Emacs manuals?  AFAIK, they
will appear in any manual that has its @documentencoding set to UTF-8.
So I think you can see that in any manual any time.

Thanks.





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

* bug#19900: 24.4; info-look.el quotes from makeinfo @item
  2015-02-19  5:40 bug#19900: 24.4; info-look.el quotes from makeinfo @item Kevin Ryde
  2015-02-19  6:11 ` Eli Zaretskii
@ 2015-03-13 18:17 ` Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2015-03-13 18:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 19900-done, Kevin Ryde

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

> Why do you confine U+2018 and U+2019 to Emacs manuals?  AFAIK, they
> will appear in any manual that has its @documentencoding set to UTF-8.
> So I think you can see that in any manual any time.

Yes, that sounds right.  I installed Kevin's patch with that change; the 
resulting patch is attached.  (This patch uses the characters themselves rather 
than \uXXXX escapes, for readability.)  Thanks for reporting the problem, Kevin. 
  Marking this as done.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: info-look.patch --]
[-- Type: text/x-patch; name="info-look.patch", Size: 7218 bytes --]

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8ddf9ed..d393190 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2015-03-13  Kevin Ryde  <user42_kevin@yahoo.com.au>
+
+	info-look fixes for Texinfo 5
+	* info-look.el (c-mode, bison-mode, makefile-mode)
+	(makefile-automake-mode, texinfo-mode, autoconf-mode, awk-mode)
+	(latex-mode, emacs-lisp-mode, sh-mode, cfengine-mode): Match
+	`foo' and 'foo' and ‘foo’ for @item and similar.
+	(latex-mode): Match multi-arg \frac{num}{den} or \sqrt[root]{n} in
+	suffix regexp.
+
 2015-03-12  Juri Linkov  <juri@linkov.net>
 
 	* simple.el (next-line-or-history-element)
diff --git a/lisp/info-look.el b/lisp/info-look.el
index 1baea46..9cf185e 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -35,6 +35,11 @@
 ;;  (or CTAN mirrors)
 ;; Perl: <URL:ftp://ftp.cpan.org/pub/CPAN/doc/manual/texinfo/> (or CPAN mirrors)
 
+;; Traditionally, makeinfo quoted `like this', but version 5 and later
+;; quotes 'like this' or ‘like this’.  Doc specs with patterns
+;; therefore match open and close quotes with ['`‘] and ['’],
+;; respectively.
+
 ;;; Code:
 
 (require 'info)
@@ -716,12 +721,12 @@ Return nil if there is nothing appropriate in the buffer near point."
              ;; suffix "\\>" is not used because that sends DBL_MAX to
              ;; DBL_MAX_EXP ("_" is a non-word char)
 	     ("(libc)Variable Index" nil
-              "^\\([ \t]+-+ \\(Variable\\|Macro\\): .*\\<\\|`\\)"
-              "\\( \\|'?$\\)")
+              "^\\([ \t]+-+ \\(Variable\\|Macro\\): .*\\<\\|['`‘]\\)"
+              "\\( \\|['’]?$\\)")
 	     ("(libc)Type Index" nil
 	      "^[ \t]+-+ Data Type: \\<" "\\>")
 	     ("(termcap)Var Index" nil
-	      "^[ \t]*`" "'"))
+	      "^[ \t]*['`‘]" "['’]"))
  :parse-rule 'info-lookup-guess-c-symbol)
 
 (info-lookup-maybe-add-help
@@ -733,7 +738,7 @@ Return nil if there is nothing appropriate in the buffer near point."
  :mode 'bison-mode
  :regexp "[:;|]\\|%\\([%{}]\\|[_a-z]+\\)\\|YY[_A-Z]+\\|yy[_a-z]+"
  :doc-spec '(("(bison)Index" nil
-	      "`" "'"))
+	      "['`‘]" "['’]"))
  :parse-rule "[:;|]\\|%\\([%{}]\\|[_a-zA-Z][_a-zA-Z0-9]*\\)"
  :other-modes '(c-mode))
 
@@ -741,7 +746,7 @@ Return nil if there is nothing appropriate in the buffer near point."
  :mode 'makefile-mode
  :regexp "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*"
  :doc-spec '(("(make)Name Index" nil
-	      "^[ \t]*`" "'"))
+	      "^[ \t]*['`‘]" "['’]"))
  :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+")
 
 (info-lookup-maybe-add-help
@@ -756,15 +761,16 @@ Return nil if there is nothing appropriate in the buffer near point."
  :doc-spec   '(
                ;; "(automake)Macro Index" is autoconf macros used in
                ;; configure.ac, not Makefile.am, so don't have that here.
-               ("(automake)Variable Index" nil "^[ \t]*`" "'")
+               ("(automake)Variable Index" nil "^[ \t]*['`‘]" "['’]")
                ;; In automake 1.4 macros and variables were a combined node.
-               ("(automake)Macro and Variable Index" nil "^[ \t]*`" "'")
+               ("(automake)Macro and Variable Index" nil "^[ \t]*['`‘]"
+		"['’]")
                ;; Directives like "if" are in the "General Index".
                ;; Prefix "`" since the text for say `+=' isn't always an
                ;; @item etc and so not always at the start of a line.
-               ("(automake)General Index" nil "`" "'")
+               ("(automake)General Index" nil "['`‘]" "['’]")
                ;; In automake 1.3 there was just a single "Index" node.
-               ("(automake)Index" nil "`" "'"))
+               ("(automake)Index" nil "['`‘]" "['’]"))
  :other-modes '(makefile-mode))
 
 (info-lookup-maybe-add-help
@@ -775,7 +781,7 @@ Return nil if there is nothing appropriate in the buffer near point."
 	      (lambda (item)
 		(if (string-match "^\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\( .*\\)?$" item)
 		    (concat "@" (match-string 1 item))))
-	      "`" "[' ]")))
+	      "['`‘]" "['’ ]")))
 
 (info-lookup-maybe-add-help
  :mode 'm4-mode
@@ -821,7 +827,7 @@ Return nil if there is nothing appropriate in the buffer near point."
 	     ;; macros (eg. AC_PROG_CC).  Ensure this is after the autoconf
 	     ;; index, so as to prefer the autoconf docs.
 	     ("(automake)Macro and Variable Index" nil
-	      "^[ \t]*`" "'"))
+	      "^[ \t]*['`‘]" "['’]"))
  ;; Autoconf symbols are M4 macros.  Thus use M4's parser.
  :parse-rule 'ignore
  :other-modes '(m4-mode))
@@ -846,7 +852,7 @@ Return nil if there is nothing appropriate in the buffer near point."
 		   ;; Built-in functions (matches to many entries).
 		   ((string-match "^[a-z]+$" item)
 		    item))))
-	      "`" "\\([ \t]*([^)]*)\\)?'")))
+	      "['`‘]" "\\([ \t]*([^)]*)\\)?['’]")))
 
 (info-lookup-maybe-add-help
  :mode 'perl-mode
@@ -885,16 +891,19 @@ Return nil if there is nothing appropriate in the buffer near point."
 		   ;; From http://home.gna.org/latexrefman
 		   "(latex2e)Command Index"
 		 "(latex)Command Index")
-	      nil "`" "\\({[^}]*}\\)?'")))
+	      ;; \frac{NUM}{DEN} etc can have more than one {xx} argument.
+	      ;; \sqrt[ROOT]{num} and others can have square brackets.
+	      nil "[`'‘]" "\\({[^}]*}|\\[[^]]*\\]\\)*['’]")))
+
 
 (info-lookup-maybe-add-help
  :mode 'emacs-lisp-mode
  :regexp "[^][()`',\" \t\n]+"
  :doc-spec '(;; Commands with key sequences appear in nodes as `foo' and
              ;; those without as `M-x foo'.
-             ("(emacs)Command Index"  nil "`\\(M-x[ \t\n]+\\)?" "'")
+             ("(emacs)Command Index"  nil "['`‘]\\(M-x[ \t\n]+\\)?" "['’]")
              ;; Variables normally appear in nodes as just `foo'.
-             ("(emacs)Variable Index" nil "`" "'")
+             ("(emacs)Variable Index" nil "['`‘]" "['’]")
              ;; Almost all functions, variables, etc appear in nodes as
              ;; " -- Function: foo" etc.  A small number of aliases and
              ;; symbols appear only as `foo', and will miss out on exact
@@ -976,9 +985,9 @@ Return nil if there is nothing appropriate in the buffer near point."
  ;; bash has "." and ":" in its index, but those chars will probably never
  ;; work in info, so don't bother matching them in the regexp.
  :regexp "\\([a-zA-Z0-9_-]+\\|[!{}@*#?$]\\|\\[\\[?\\|]]?\\)"
- :doc-spec '(("(bash)Builtin Index"       nil "^`" "[ .']")
-             ("(bash)Reserved Word Index" nil "^`" "[ .']")
-             ("(bash)Variable Index"      nil "^`" "[ .']")
+ :doc-spec '(("(bash)Builtin Index"       nil "^['`‘]" "[ .'’]")
+             ("(bash)Reserved Word Index" nil "^['`‘]" "[ .'’]")
+             ("(bash)Variable Index"      nil "^['`‘]" "[ .'’]")
 
              ;; coreutils (version 4.5.10) doesn't have a separate program
              ;; index, so exclude extraneous stuff (most of it) by demanding
@@ -1026,7 +1035,7 @@ Return nil if there is nothing appropriate in the buffer near point."
 		  item))
 	      ;; This gets functions in evaluated classes.  Other
 	      ;; possible patterns don't seem to work too well.
-	      "`" "(")))
+	      "['`‘]" "(")))
 
 (info-lookup-maybe-add-help
  :mode 'Custom-mode

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

end of thread, other threads:[~2015-03-13 18:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-19  5:40 bug#19900: 24.4; info-look.el quotes from makeinfo @item Kevin Ryde
2015-02-19  6:11 ` Eli Zaretskii
2015-03-13 18:17 ` Paul Eggert

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