* bug#8660: 23.2; info-look.el makefile-mode derivatives
@ 2011-05-12 0:21 Kevin Ryde
2011-05-12 3:11 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2011-05-12 0:21 UTC (permalink / raw)
To: 8660
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
C-h S in the various makefile-mode derivatives such as
makefile-gmake-mode for GNUmakefile prompts for
Use symbol help mode:
where I hoped it would already know what to do.
Perhaps something like the following, also confining the automake manual
things to the automake mode. It and the make manual overlap in a few
places, mainly variables like LFLAGS etc.
2011-05-11 Kevin Ryde <user42@zip.com.au>
* info-look.el (makefile-automake-mode): New setups, looking in
automake manual, then makefile-mode.
(makefile-mode): Remove automake manual, have it just in
makefile-automake-mode. Remove non-existent automake-mode,
believe a hypothetical automake-mode would go to makefile-mode,
not the other way around.
(makefile-bsdmake-mode, makefile-gmake-mode, makefile-imake-mode)
(makefile-makepp-mode): New setups, just going to makefile-mode.
In particular makefile-gmake-mode lets lookups work from a
GNUmakefile.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: info-look.el.makefile-derivatives.diff --]
[-- Type: text/x-diff, Size: 2281 bytes --]
--- info-look.el.orig 2011-05-12 08:36:49.000000000 +1000
+++ info-look.el 2011-05-12 10:13:37.000000000 +1000
@@ -720,11 +720,44 @@
:mode 'makefile-mode
:regexp "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*"
:doc-spec '(("(make)Name Index" nil
- "^[ \t]*`" "'")
- ("(automake)Macro and Variable Index" nil
"^[ \t]*`" "'"))
- :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+"
- :other-modes '(automake-mode))
+ :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+")
+
+(info-lookup-maybe-add-help
+ :topic 'symbol
+ :mode 'makefile-automake-mode
+ ;; similar regexp/parse-rule as makefile-mode, but also
+ ;; "##" special automake comment
+ ;; "+=" append operator, separate from the GNU make one
+ :regexp "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*\\|##\\|\\+="
+ :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+\\|##\\|\\+="
+ :doc-spec '(
+ ;; "(automake)Macro Index" is autoconf macros used in
+ ;; configure.in, not Makefile.am, so don't have that here.
+ ("(automake)Variable Index" nil "^[ \t]*`" "'")
+ ;; In automake 1.4 macros and variables were a combined node.
+ ("(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 "`" "'")
+ ;; In automake 1.3 there was just a single "Index" node.
+ ("(automake)Index" nil "`" "'"))
+ :other-modes '(makefile-mode))
+
+;; makefile-mode derivatives going to plain makefile-mode.
+(let ((regexp (info-lookup->regexp 'symbol 'makefile-mode))
+ (parse-rule (info-lookup->parse-rule 'symbol 'makefile-mode)))
+ (dolist (mode '(makefile-bsdmake-mode
+ makefile-gmake-mode
+ makefile-imake-mode
+ makefile-makepp-mode))
+ (info-lookup-maybe-add-help
+ :topic 'symbol
+ :mode mode
+ :regexp regexp
+ :parse-rule parse-rule
+ :other-modes '(makefile-mode))))
(info-lookup-maybe-add-help
:mode 'texinfo-mode
[-- Attachment #3: Type: text/plain, Size: 1056 bytes --]
In GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
of 2010-05-16 on raven, modified by Debian
configured using `configure '--build' 'i486-linux-gnu' '--build' '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.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_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] 8+ messages in thread
* bug#8660: 23.2; info-look.el makefile-mode derivatives
2011-05-12 0:21 bug#8660: 23.2; info-look.el makefile-mode derivatives Kevin Ryde
@ 2011-05-12 3:11 ` Stefan Monnier
2011-05-14 1:37 ` Kevin Ryde
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2011-05-12 3:11 UTC (permalink / raw)
To: Kevin Ryde; +Cc: 8660
> C-h S in the various makefile-mode derivatives such as
> makefile-gmake-mode for GNUmakefile prompts for
> Use symbol help mode:
> where I hoped it would already know what to do.
[...]
> +;; makefile-mode derivatives going to plain makefile-mode.
> +(let ((regexp (info-lookup->regexp 'symbol 'makefile-mode))
> + (parse-rule (info-lookup->parse-rule 'symbol 'makefile-mode)))
> + (dolist (mode '(makefile-bsdmake-mode
> + makefile-gmake-mode
> + makefile-imake-mode
> + makefile-makepp-mode))
> + (info-lookup-maybe-add-help
> + :topic 'symbol
> + :mode mode
> + :regexp regexp
> + :parse-rule parse-rule
> + :other-modes '(makefile-mode))))
I think you want to set info-lookup-mode in those major modes instead.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#8660: 23.2; info-look.el makefile-mode derivatives
2011-05-12 3:11 ` Stefan Monnier
@ 2011-05-14 1:37 ` Kevin Ryde
2011-05-14 3:55 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2011-05-14 1:37 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 8660
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
> I think you want to set info-lookup-mode in those major modes instead.
I suppose that would work, but no modes do that do they?
I see lisp-mode and lisp-interaction-mode are aliased within
info-look.el itself. (The apropos-mode one is by me, so
discount that :-)
I suppose also info-look might check a derived-mode-parent if a mode
doesn't have its own setup. That might pick up more things with less
effort in each mode.
--
"Even the white bits were black"
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#8660: 23.2; info-look.el makefile-mode derivatives
2011-05-14 1:37 ` Kevin Ryde
@ 2011-05-14 3:55 ` Stefan Monnier
2011-05-16 0:02 ` Kevin Ryde
2013-02-16 0:02 ` Kevin Ryde
0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2011-05-14 3:55 UTC (permalink / raw)
To: Kevin Ryde; +Cc: 8660
>> I think you want to set info-lookup-mode in those major modes instead.
> I suppose that would work, but no modes do that do they?
inferior-octave-mode uses it.
> I suppose also info-look might check a derived-mode-parent if a mode
> doesn't have its own setup. That might pick up more things with less
> effort in each mode.
Oh, yes, that would be a better change. Patch welcome.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#8660: 23.2; info-look.el makefile-mode derivatives
2011-05-14 3:55 ` Stefan Monnier
@ 2011-05-16 0:02 ` Kevin Ryde
2011-05-16 17:42 ` Stefan Monnier
2013-02-16 0:02 ` Kevin Ryde
1 sibling, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2011-05-16 0:02 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 8660
[-- Attachment #1: Type: text/plain, Size: 886 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
> inferior-octave-mode uses it.
I saw that, in `octave-help', but presumed it was to make that command
independent of the major mode, ie. since the command is "octave-help" it
should always consult the octave docs.
> Oh, yes, that would be a better change. Patch welcome.
Would you like to take the automakery bit first and I'll see what I can
get to for the derived,
2011-05-15 Kevin Ryde <user42@zip.com.au>
* info-look.el (makefile-automake-mode): New setups, looking in
automake manual, then makefile-mode.
(makefile-mode): Remove automake manual, have it just in
makefile-automake-mode since there's various things different or
not relevant to plain make.
(makefile-mode): Remove "other-modes" non-existent automake-mode,
believe a hypothetical automake-mode would go to makefile-mode,
not the other way around.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: info-look.el.makefile-derivatives-2.diff --]
[-- Type: text/x-diff, Size: 1787 bytes --]
--- info-look.el.orig 2011-05-12 08:36:49.000000000 +1000
+++ info-look.el 2011-05-16 09:53:41.000000000 +1000
@@ -720,11 +720,31 @@
:mode 'makefile-mode
:regexp "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*"
:doc-spec '(("(make)Name Index" nil
- "^[ \t]*`" "'")
- ("(automake)Macro and Variable Index" nil
"^[ \t]*`" "'"))
- :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+"
- :other-modes '(automake-mode))
+ :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+")
+
+(info-lookup-maybe-add-help
+ :topic 'symbol
+ :mode 'makefile-automake-mode
+ ;; similar regexp/parse-rule as makefile-mode, but also the following
+ ;; (which have index entries),
+ ;; "##" special automake comment
+ ;; "+=" append operator, separate from the GNU make one
+ :regexp "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*\\|##\\|\\+="
+ :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+\\|##\\|\\+="
+ :doc-spec '(
+ ;; "(automake)Macro Index" is autoconf macros used in
+ ;; configure.in, not Makefile.am, so don't have that here.
+ ("(automake)Variable Index" nil "^[ \t]*`" "'")
+ ;; In automake 1.4 macros and variables were a combined node.
+ ("(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 "`" "'")
+ ;; In automake 1.3 there was just a single "Index" node.
+ ("(automake)Index" nil "`" "'"))
+ :other-modes '(makefile-mode))
(info-lookup-maybe-add-help
:mode 'texinfo-mode
[-- Attachment #3: Type: text/plain, Size: 293 bytes --]
--
At Sydney airport Australian passport holders may be asked to verify
their citizenship by singing the national anthem. It's a trick. Anyone
who knows more than the first two lines is an imposter. If you get to
"girt by sea" and know what that means then expect a trip to Villawood.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#8660: 23.2; info-look.el makefile-mode derivatives
2011-05-16 0:02 ` Kevin Ryde
@ 2011-05-16 17:42 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2011-05-16 17:42 UTC (permalink / raw)
To: Kevin Ryde; +Cc: 8660
>> inferior-octave-mode uses it.
> I saw that, in `octave-help', but presumed it was to make that command
> independent of the major mode, ie. since the command is "octave-help" it
> should always consult the octave docs.
In Emacs-24, octave-help is not used any more, instead we set
info-lookup-mode directly in inferior-octave-mode so that C-h S works.
> Would you like to take the automakery bit first and I'll see what I can
> get to for the derived,
Thanks, installed,
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#8660: 23.2; info-look.el makefile-mode derivatives
2011-05-14 3:55 ` Stefan Monnier
2011-05-16 0:02 ` Kevin Ryde
@ 2013-02-16 0:02 ` Kevin Ryde
2013-02-16 17:21 ` Stefan Monnier
1 sibling, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2013-02-16 0:02 UTC (permalink / raw)
To: 8660
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> I suppose also info-look might check a derived-mode-parent if a mode
>> doesn't have its own setup. That might pick up more things with less
>> effort in each mode.
>
> Oh, yes, that would be a better change. Patch welcome.
It took a while but I made the couple of lines below.
I considered having the lookup bits such as info-lookup->mode-value do
their lookups under a parent mode if the given mode has nothing. But I
think there are too many complications from that. Some calls are asking
if there's anything before adding and thus don't want a fallback. The
caching bits probably would want to cache against the actual name rather
than any derived child name. And behaviour would subtly change after a
derived mode has loaded and thus gained a `derived-mode-parent'
property.
A nicer default `info-lookup-mode' should do only good, and it won't
affect anything which explicitly selects an info-lookup-mode itself.
2013-02-16 Kevin Ryde <user42@zip.com.au>
* info-look.el (info-lookup-select-mode): If major-mode has no
info-lookup-alist entry then search up derived-mode-parent.
This means a define-derived-mode uses its parent's info-look setups
if it has none of its own. Helps `makefile-gmake-mode' and friends
automatically use their parent `makefile-mode' instead of prompting
for a mode.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: info-look.el.derived-mode-parent.diff --]
[-- Type: text/x-diff, Size: 1382 bytes --]
diff -u /home/gg/bug/info-look-parent/info-look.el.orig /home/gg/bug/info-look-parent/info-look.el
--- /home/gg/bug/info-look-parent/info-look.el.orig 2012-09-09 07:58:12.000000000 +1000
+++ /home/gg/bug/info-look-parent/info-look.el 2013-02-16 10:47:30.000000000 +1100
@@ -298,6 +298,21 @@
(when (string-match (caar file-name-alist) file-name)
(setq info-lookup-mode (cdar file-name-alist)))
(setq file-name-alist (cdr file-name-alist)))))
+
+ ;; If major-mode has no setups in info-lookup-alist, under any topic, then
+ ;; search up through derived-mode-parent to find a parent mode which does
+ ;; have some setups. This means that a `define-derived-mode' with no
+ ;; setups of its own will select its parent mode for lookups, if one of
+ ;; its parents has some setups. Good for example on `makefile-gmake-mode'
+ ;; and similar derivatives of `makefile-mode'.
+ ;;
+ (let ((mode major-mode)) ;; look for `mode' with some setups
+ (while (and mode (not info-lookup-mode))
+ (dolist (topic-cell info-lookup-alist) ;; usually only two topics here
+ (if (info-lookup->mode-value (car topic-cell) mode)
+ (setq info-lookup-mode mode)))
+ (setq mode (get mode 'derived-mode-parent))))
+
(or info-lookup-mode (setq info-lookup-mode major-mode)))
(defun info-lookup-change-mode (topic)
Diff finished. Sat Feb 16 10:48:55 2013
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#8660: 23.2; info-look.el makefile-mode derivatives
2013-02-16 0:02 ` Kevin Ryde
@ 2013-02-16 17:21 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2013-02-16 17:21 UTC (permalink / raw)
To: Kevin Ryde; +Cc: 8660-done
> It took a while but I made the couple of lines below.
Thank you, installed (with comments capitalized and punctuated).
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-02-16 17:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-12 0:21 bug#8660: 23.2; info-look.el makefile-mode derivatives Kevin Ryde
2011-05-12 3:11 ` Stefan Monnier
2011-05-14 1:37 ` Kevin Ryde
2011-05-14 3:55 ` Stefan Monnier
2011-05-16 0:02 ` Kevin Ryde
2011-05-16 17:42 ` Stefan Monnier
2013-02-16 0:02 ` Kevin Ryde
2013-02-16 17:21 ` Stefan Monnier
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).