all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#27583: 24.5; `info.el': some test for (eq major-mode 'Info-mode)
@ 2017-07-05  2:11 Drew Adams
  2019-08-27  1:39 ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2017-07-05  2:11 UTC (permalink / raw)
  To: 27583

Most of the places where `major-mode' is tested use a test like this:
(derived-mode-p 'Info-mode).  But there are still a few places where
this is done: (eq major-mode 'Info-mode).

I think (but am not positive) that each of the latter tests should be
changed to use `derived-mode-p', to let users and libraries define and
use modes that are derived from `Info-mode'.

It looks like the places that still use (eq major-mode 'Info-mode)
constitute code that doesn't get much love.  The occurrences are in
these 3 things:

 Info-hide-note-references (in the option's :set function)
 info-display-manual
 info--manual-names (used only by info-display-manual)



In GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/usr --host=i686-pc-mingw32'





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

* bug#27583: 24.5; `info.el': some test for (eq major-mode 'Info-mode)
  2017-07-05  2:11 bug#27583: 24.5; `info.el': some test for (eq major-mode 'Info-mode) Drew Adams
@ 2019-08-27  1:39 ` Stefan Kangas
  2019-08-27  2:33   ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2019-08-27  1:39 UTC (permalink / raw)
  To: Drew Adams; +Cc: 27583

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

tags 27583 + patch
quit

Drew Adams <drew.adams@oracle.com> writes:

> Most of the places where `major-mode' is tested use a test like this:
> (derived-mode-p 'Info-mode).  But there are still a few places where
> this is done: (eq major-mode 'Info-mode).
>
> I think (but am not positive) that each of the latter tests should be
> changed to use `derived-mode-p', to let users and libraries define and
> use modes that are derived from `Info-mode'.
>
> It looks like the places that still use (eq major-mode 'Info-mode)
> constitute code that doesn't get much love.  The occurrences are in
> these 3 things:
>
>  Info-hide-note-references (in the option's :set function)
>  info-display-manual
>  info--manual-names (used only by info-display-manual)

Makes sense.  How about the attached patch?

Best regards,
Stefan Kangas

[-- Attachment #2: 0001-Use-derived-mode-p-consistently-in-info.el.patch --]
[-- Type: text/x-patch, Size: 1447 bytes --]

From ad638cb9787c42d4c8a25337fb7843e0fdea6e74 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Tue, 27 Aug 2019 03:36:05 +0200
Subject: [PATCH] Use derived-mode-p consistently in info.el

* lisp/info.el (Info-hide-note-references, info-display-manual)
(info--manual-names): Use derived-mode-p.  (Bug#27583)
---
 lisp/info.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/info.el b/lisp/info.el
index 17a2d63e6d..bcfaddcf5a 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -318,7 +318,7 @@ Info-hide-note-references
 	 (set sym val)
 	 (dolist (buffer (buffer-list))
 	   (with-current-buffer buffer
-	     (when (eq major-mode 'Info-mode)
+	     (when (derived-mode-p 'Info-mode)
 	       (revert-buffer t t)))))
   :group 'info)
 
@@ -5300,7 +5300,7 @@ info-display-manual
 	found)
     (dolist (buffer blist)
       (with-current-buffer buffer
-	(when (and (eq major-mode 'Info-mode)
+        (when (and (derived-mode-p 'Info-mode)
 		   (stringp Info-current-file)
 		   (string-match manual-re Info-current-file))
 	  (setq found buffer
@@ -5315,7 +5315,7 @@ info--manual-names
   (let (names)
     (dolist (buffer (buffer-list))
       (with-current-buffer buffer
-	(and (eq major-mode 'Info-mode)
+        (and (derived-mode-p 'Info-mode)
 	     (stringp Info-current-file)
 	     (not (string= (substring (buffer-name) 0 1) " "))
 	     (push (file-name-sans-extension
-- 
2.20.1


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

* bug#27583: 24.5; `info.el': some test for (eq major-mode 'Info-mode)
  2019-08-27  1:39 ` Stefan Kangas
@ 2019-08-27  2:33   ` Drew Adams
  2019-09-03 18:23     ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2019-08-27  2:33 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 27583

> How about the attached patch?

LGTM.

I have a tiny doubt that we can be sure
that an arbitrary derived mode would call
for those things, but that's a problem that's
not special to Info, I guess.

Thx.





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

* bug#27583: 24.5; `info.el': some test for (eq major-mode 'Info-mode)
  2019-08-27  2:33   ` Drew Adams
@ 2019-09-03 18:23     ` Stefan Kangas
  2019-09-07 22:20       ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2019-09-03 18:23 UTC (permalink / raw)
  To: Drew Adams; +Cc: 27583

Drew Adams <drew.adams@oracle.com> writes:

> > How about the attached patch?
>
> LGTM.

Thanks.  If no one has any objections, I'll install it in a couple of days.

Best regards,
Stefan Kangas





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

* bug#27583: 24.5; `info.el': some test for (eq major-mode 'Info-mode)
  2019-09-03 18:23     ` Stefan Kangas
@ 2019-09-07 22:20       ` Stefan Kangas
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2019-09-07 22:20 UTC (permalink / raw)
  To: Drew Adams; +Cc: 27583

close 27583 27.1
quit

Stefan Kangas <stefan@marxist.se> writes:
> If no one has any objections, I'll install it in a couple of days.

Now pushed to master as commit 8e93e6da7c.

Thanks,
Stefan Kangas





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

end of thread, other threads:[~2019-09-07 22:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-05  2:11 bug#27583: 24.5; `info.el': some test for (eq major-mode 'Info-mode) Drew Adams
2019-08-27  1:39 ` Stefan Kangas
2019-08-27  2:33   ` Drew Adams
2019-09-03 18:23     ` Stefan Kangas
2019-09-07 22:20       ` Stefan Kangas

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.