all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#24985: Add missing provide statements
@ 2016-11-22 10:42 Philippe Vaucher
  2016-11-22 12:15 ` Michael Albinus
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Vaucher @ 2016-11-22 10:42 UTC (permalink / raw)
  To: 24985


[-- Attachment #1.1: Type: text/plain, Size: 732 bytes --]

Hello,

While correcting misuse of `eval-after-load' in some libraries, we
discovered that `text-mode' does not `provide' itself as a feature.

That forces people to use `eval-after-load' with a string (filename),
instead of a symbol (feature), which is the better form. It is the better
form because with a string, any file named the same way triggers the
eval-after-load which is problematic for custom configurations named after
packages.

Original thread at https://github.com/magnars/expand-region.el/pull/212

I used the following command to figure out which other files might need
additional `provide' statements:

grep -rL '(provide' ~/work/emacs/lisp | xargs egrep 'define-[^ ]+-mode' |
grep -v ChangeLog

Thanks,
Philippe

[-- Attachment #1.2: Type: text/html, Size: 1036 bytes --]

[-- Attachment #2: 0001-Add-missing-provide-statements.patch --]
[-- Type: text/x-patch, Size: 1600 bytes --]

From b0b8720c4eecf44ab63ec85bcb6b92958ced48cb Mon Sep 17 00:00:00 2001
From: Philippe Vaucher <philippe.vaucher@stvs.com>
Date: Tue, 22 Nov 2016 09:35:22 +0100
Subject: [PATCH] Add missing provide statements

* lisp/composite.el: add provide statement
* lisp/replace.el: add provide statement
* lisp/textmodes/text-mode.el: add provide statement
---
 lisp/composite.el           | 2 ++
 lisp/replace.el             | 2 ++
 lisp/textmodes/text-mode.el | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/lisp/composite.el b/lisp/composite.el
index 94b14df..262f121 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -843,6 +843,8 @@ For more information on Auto Composition mode, see
 
 (defalias 'toggle-auto-composition 'auto-composition-mode)
 
+(provide 'auto-composition-mode)
+
 \f
 
 ;;; composite.el ends here
diff --git a/lisp/replace.el b/lisp/replace.el
index eb5e0cf..ef15f61 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1823,6 +1823,8 @@ See also `multi-occur'."
      ;; And the second element is the list of context after-lines.
      (if (> nlines 0) after-lines))))
 
+(provide 'occur)
+
 \f
 ;; It would be nice to use \\[...], but there is no reasonable way
 ;; to make that display both SPC and Y.
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 731c2d2..51a7bbe 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -232,4 +232,6 @@ The argument NLINES says how many lines to center."
 	   (setq nlines (1+ nlines))
 	   (forward-line -1)))))
 
+(provide 'text-mode)
+
 ;;; text-mode.el ends here
-- 
2.10.2


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

* bug#24985: Add missing provide statements
  2016-11-22 10:42 bug#24985: Add missing provide statements Philippe Vaucher
@ 2016-11-22 12:15 ` Michael Albinus
  2016-11-22 13:58   ` Philippe Vaucher
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2016-11-22 12:15 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: 24985

Philippe Vaucher <philippe.vaucher@gmail.com> writes:

> Hello,

Hi Philippe,

> diff --git a/lisp/composite.el b/lisp/composite.el
> index 94b14df..262f121 100644
> --- a/lisp/composite.el
> +++ b/lisp/composite.el
> @@ -843,6 +843,8 @@ For more information on Auto Composition mode, see
>  
>  (defalias 'toggle-auto-composition 'auto-composition-mode)
>  
> +(provide 'auto-composition-mode)

Why that? I would expect (provide 'composite) here.

Best regards, Michael.





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

* bug#24985: Add missing provide statements
  2016-11-22 12:15 ` Michael Albinus
@ 2016-11-22 13:58   ` Philippe Vaucher
  2016-11-22 15:13     ` Michael Albinus
  2016-11-25 10:27     ` Eli Zaretskii
  0 siblings, 2 replies; 12+ messages in thread
From: Philippe Vaucher @ 2016-11-22 13:58 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 24985


[-- Attachment #1.1: Type: text/plain, Size: 600 bytes --]

>
> >  (defalias 'toggle-auto-composition 'auto-composition-mode)
> >
> > +(provide 'auto-composition-mode)
>
> Why that? I would expect (provide 'composite) here.
>

I thought that the most interesting thing in composite was
auto-composition-mode... same reasoning for replace.el which provided
'occur in my first patch.

Anyway, you're right, it's not very consistent. Here attached is a new
patch that simply follows the file name.

In the future, I think we should consider renaming/splitting these files so
each mode provide its feature (e.g occur provides 'occur, etc).

Best regards,
Philippe

[-- Attachment #1.2: Type: text/html, Size: 988 bytes --]

[-- Attachment #2: 0001-Add-missing-provide-statements.patch --]
[-- Type: text/x-patch, Size: 1458 bytes --]

From f86383d8ff683bc88a1410708d8e52a33d38fa67 Mon Sep 17 00:00:00 2001
From: Philippe Vaucher <philippe.vaucher@stvs.com>
Date: Tue, 22 Nov 2016 09:35:22 +0100
Subject: [PATCH] Add missing provide statements

* lisp/composite.el: add provide statement
* lisp/replace.el: add provide statement
* lisp/textmodes/text-mode.el: add provide statement
---
 lisp/composite.el           | 2 ++
 lisp/replace.el             | 2 ++
 lisp/textmodes/text-mode.el | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/lisp/composite.el b/lisp/composite.el
index 94b14df..53013c1 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -843,6 +843,8 @@ For more information on Auto Composition mode, see
 
 (defalias 'toggle-auto-composition 'auto-composition-mode)
 
+(provide 'composite)
+
 \f
 
 ;;; composite.el ends here
diff --git a/lisp/replace.el b/lisp/replace.el
index eb5e0cf..ae1c192 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2544,4 +2544,6 @@ It must return a string."
 		   "")))
     (or (and keep-going stack) multi-buffer)))
 
+(provide 'replace)
+
 ;;; replace.el ends here
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 731c2d2..51a7bbe 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -232,4 +232,6 @@ The argument NLINES says how many lines to center."
 	   (setq nlines (1+ nlines))
 	   (forward-line -1)))))
 
+(provide 'text-mode)
+
 ;;; text-mode.el ends here
-- 
2.10.2


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

* bug#24985: Add missing provide statements
  2016-11-22 13:58   ` Philippe Vaucher
@ 2016-11-22 15:13     ` Michael Albinus
  2016-11-23  9:26       ` Philippe Vaucher
  2016-11-25 10:27     ` Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2016-11-22 15:13 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: 24985

Philippe Vaucher <philippe.vaucher@gmail.com> writes:

> I thought that the most interesting thing in composite was
> auto-composition-mode... same reasoning for replace.el which provided
> 'occur in my first patch.

See the docstring of `require':

If feature FEATURE is not loaded, load it from FILENAME ... If FILENAME
is omitted, the printname of FEATURE is used as the file name.

Therefore, it is always a good practice to provide a feature with the
same name as the file.

> Best regards,
> Philippe

Best regards, Michael.





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

* bug#24985: Add missing provide statements
  2016-11-22 15:13     ` Michael Albinus
@ 2016-11-23  9:26       ` Philippe Vaucher
  2016-11-23  9:46         ` Michael Albinus
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Vaucher @ 2016-11-23  9:26 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 24985

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

>
> Therefore, it is always a good practice to provide a feature with the
> same name as the file.
>

Yes, hence my second patch.

Okay, is there anything else to discuss? Is the patch ok?

Best regards,
Philippe

[-- Attachment #2: Type: text/html, Size: 493 bytes --]

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

* bug#24985: Add missing provide statements
  2016-11-23  9:26       ` Philippe Vaucher
@ 2016-11-23  9:46         ` Michael Albinus
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Albinus @ 2016-11-23  9:46 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: 24985

Philippe Vaucher <philippe.vaucher@gmail.com> writes:

> Okay, is there anything else to discuss? Is the patch ok?

Nothing else from my pov.

> Best regards,
> Philippe

Best regards, Michael.





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

* bug#24985: Add missing provide statements
  2016-11-22 13:58   ` Philippe Vaucher
  2016-11-22 15:13     ` Michael Albinus
@ 2016-11-25 10:27     ` Eli Zaretskii
  2016-11-25 11:51       ` Philippe Vaucher
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2016-11-25 10:27 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: michael.albinus, 24985

> From: Philippe Vaucher <philippe.vaucher@gmail.com>
> Date: Tue, 22 Nov 2016 14:58:19 +0100
> Cc: 24985@debbugs.gnu.org
> 
>  > (defalias 'toggle-auto-composition 'auto-composition-mode)
>  >
>  > +(provide 'auto-composition-mode)
> 
>  Why that? I would expect (provide 'composite) here.
> 
> I thought that the most interesting thing in composite was auto-composition-mode... same reasoning for
> replace.el which provided 'occur in my first patch.
> 
> Anyway, you're right, it's not very consistent. Here attached is a new patch that simply follows the file name.

Thanks, pushed to master.

In the future, please start each sentence in the log entry with a
capital letter, and end it with a period.  Here's how I reformatted
your log message:

* lisp/composite.el:
* lisp/replace.el:
* lisp/textmodes/text-mode.el: Add provide statement.





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

* bug#24985: Add missing provide statements
  2016-11-25 10:27     ` Eli Zaretskii
@ 2016-11-25 11:51       ` Philippe Vaucher
  2016-11-26  1:07         ` Richard Stallman
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Vaucher @ 2016-11-25 11:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Michael Albinus, 24985

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

>
> In the future, please start each sentence in the log entry with a
> capital letter, and end it with a period.  Here's how I reformatted
> your log message:
>
> * lisp/composite.el:
> * lisp/replace.el:
> * lisp/textmodes/text-mode.el: Add provide statement.
>

Alright. Thanks!

Philippe

[-- Attachment #2: Type: text/html, Size: 612 bytes --]

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

* bug#24985: Add missing provide statements
  2016-11-25 11:51       ` Philippe Vaucher
@ 2016-11-26  1:07         ` Richard Stallman
  2016-11-26  7:17           ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2016-11-26  1:07 UTC (permalink / raw)
  To: Philippe Vaucher; +Cc: michael.albinus, 24985

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > * lisp/composite.el:
  > > * lisp/replace.el:
  > > * lisp/textmodes/text-mode.el: Add provide statement.

Why do these files need a provide?
They are always loaded.

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.






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

* bug#24985: Add missing provide statements
  2016-11-26  1:07         ` Richard Stallman
@ 2016-11-26  7:17           ` Eli Zaretskii
  2016-11-26  9:17             ` Michael Albinus
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2016-11-26  7:17 UTC (permalink / raw)
  To: rms; +Cc: philippe.vaucher, michael.albinus, 24985

> From: Richard Stallman <rms@gnu.org>
> CC: eliz@gnu.org, michael.albinus@gmx.de, 24985@debbugs.gnu.org
> Date: Fri, 25 Nov 2016 20:07:34 -0500
> 
>   > > * lisp/composite.el:
>   > > * lisp/replace.el:
>   > > * lisp/textmodes/text-mode.el: Add provide statement.
> 
> Why do these files need a provide?
> They are always loaded.

Yes, they are always loaded.  But having a provide in them doesn't
hurt anything, AFAICT.





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

* bug#24985: Add missing provide statements
  2016-11-26  7:17           ` Eli Zaretskii
@ 2016-11-26  9:17             ` Michael Albinus
  2016-11-26 10:07               ` Philippe Vaucher
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus @ 2016-11-26  9:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: philippe.vaucher, rms, 24985

Eli Zaretskii <eliz@gnu.org> writes:

>>   > > * lisp/composite.el:
>>   > > * lisp/replace.el:
>>   > > * lisp/textmodes/text-mode.el: Add provide statement.
>> 
>> Why do these files need a provide?
>> They are always loaded.
>
> Yes, they are always loaded.  But having a provide in them doesn't
> hurt anything, AFAICT.

And in case they are required somewhere else, they would be reloaded,
w/o a provide.

Best regards, Michael.





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

* bug#24985: Add missing provide statements
  2016-11-26  9:17             ` Michael Albinus
@ 2016-11-26 10:07               ` Philippe Vaucher
  0 siblings, 0 replies; 12+ messages in thread
From: Philippe Vaucher @ 2016-11-26 10:07 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 24985, rms

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

> And in case they are required somewhere else, they would be reloaded,
> w/o a provide.

Also like I said in my original bug report, it forced people using
"eval-after-load" to use the string parameter, which leads to
problems/inconsistency in custom config or tests.

Now maybe using eval-after-load for these modes is a mistake but again it
is not very consistent.

Philippe

[-- Attachment #2: Type: text/html, Size: 467 bytes --]

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

end of thread, other threads:[~2016-11-26 10:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-22 10:42 bug#24985: Add missing provide statements Philippe Vaucher
2016-11-22 12:15 ` Michael Albinus
2016-11-22 13:58   ` Philippe Vaucher
2016-11-22 15:13     ` Michael Albinus
2016-11-23  9:26       ` Philippe Vaucher
2016-11-23  9:46         ` Michael Albinus
2016-11-25 10:27     ` Eli Zaretskii
2016-11-25 11:51       ` Philippe Vaucher
2016-11-26  1:07         ` Richard Stallman
2016-11-26  7:17           ` Eli Zaretskii
2016-11-26  9:17             ` Michael Albinus
2016-11-26 10:07               ` Philippe Vaucher

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.