GNU bug report logs - #2470
23.0.90; auto-fill-mode, :minor-mode-function

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Wed, 25 Feb 2009 18:05:05 UTC

Severity: minor

Tags: fixed

Fixed in version 24.1

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 2470 in the body.
You can then email your comments to 2470 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2470; Package emacs. (Wed, 25 Feb 2009 18:05:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 25 Feb 2009 18:05:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <emacs-pretest-bug <at> gnu.org>
Subject: 23.0.90; auto-fill-mode, :minor-mode-function
Date: Wed, 25 Feb 2009 09:59:33 -0800
1. Someone on EmacsWiki asked how to tell if a given minor mode is
on.  I said to check the mode variable.  The reply was that
auto-fill-mode has no mode variable. 
 
The code shows this:
 
(put 'auto-fill-function :minor-mode-function 'auto-fill-mode)
;; FIXME: turn into a proper minor mode.
;; Add a global minor mode version of it.
(defun auto-fill-mode (&optional arg)
...
 
So it seems to be in need of a fix, but I see no bug filed against it.
 

2. What is :minor-mode-function?  It is used in a couple of places in
the Emacs Lisp sources, with no comment or other explanation.  It is
not in the Elisp manual.  It seems to be a way to associate a
different function with a minor mode - a function with a different
name from the mode itself.  For example, `auto-fill-function' is the
:minor-mode-function for `auto-fill-mode'.
 
Is this mechanism still needed if `define-minor-mode' is used?  Is it
just for compatibility with XEmacs code and legacy code?
 
How about documenting it - at least with a comment in the code
somewhere: what is for, how and when to use it.
 

In GNU Emacs 23.0.90.1 (i386-mingw-nt5.1.2600)
 of 2009-02-01 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
 





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2470; Package emacs. (Wed, 25 Feb 2009 20:05:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 25 Feb 2009 20:05:06 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 2470 <at> debbugs.gnu.org, <emacs-pretest-bug <at> gnu.org>
Subject: Re: bug#2470: 23.0.90; auto-fill-mode, :minor-mode-function
Date: Wed, 25 Feb 2009 14:56:44 -0500
> So it seems to be in need of a fix, but I see no bug filed against it.

Then file one.

> 2. What is :minor-mode-function?  It is used in a couple of places in
> the Emacs Lisp sources, with no comment or other explanation.  It is
> not in the Elisp manual.  It seems to be a way to associate a
> different function with a minor mode - a function with a different
> name from the mode itself.  For example, `auto-fill-function' is the
> :minor-mode-function for `auto-fill-mode'.
 
> Is this mechanism still needed if `define-minor-mode' is used?  Is it
> just for compatibility with XEmacs code and legacy code?

It's got nothing to do with XEmacs, AFAIK, but it does have with legacy
code such as auto-fill-function.
 
> How about documenting it - at least with a comment in the code
> somewhere: what is for, how and when to use it.
 
When to use it, is easy: never in new code.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2470; Package emacs. (Wed, 25 Feb 2009 20:05:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 25 Feb 2009 20:05:09 GMT) Full text and rfc822 format available.

Message #15 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> IRO.UMontreal.CA>
Cc: <2470 <at> debbugs.gnu.org>, <emacs-pretest-bug <at> gnu.org>
Subject: RE: bug#2470: 23.0.90; auto-fill-mode, :minor-mode-function
Date: Wed, 25 Feb 2009 12:02:18 -0800
> From: Stefan Monnier Sent: Wednesday, February 25, 2009 11:57 AM
> > So it seems to be in need of a fix, but I see no bug filed 
> > against it.
> 
> Then file one.

Is it a joke? That's what this bug report is.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2470; Package emacs. (Wed, 25 Feb 2009 20:05:10 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 25 Feb 2009 20:05:11 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2470; Package emacs. (Wed, 25 Feb 2009 20:05:12 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 25 Feb 2009 20:05:12 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#2470; Package emacs. (Sat, 09 Jul 2011 22:17:01 GMT) Full text and rfc822 format available.

Message #28 received at 2470 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 2470 <at> debbugs.gnu.org
Subject: Re: bug#2470: 23.0.90; auto-fill-mode, :minor-mode-function
Date: Sun, 10 Jul 2011 00:16:10 +0200
On Wed, Feb 25, 2009 at 18:59, Drew Adams <drew.adams <at> oracle.com> wrote:

> I said to check the mode variable.  The reply was that
> auto-fill-mode has no mode variable.

As you point out below, the "mode variable" for auto-fill-mode is
auto-fill-function. Is what gets set in minor-mode-alist, and its a
reliable way to know whether the mode is active or not.

> ;; FIXME: turn into a proper minor mode.
> ;; Add a global minor mode version of it.
> (defun auto-fill-mode (&optional arg)
> ...
>
> So it seems to be in need of a fix, but I see no bug filed against it.

It now says:

;; FIXME: turn into a proper minor mode.
;; Add a global minor mode version of it.
(define-minor-mode auto-fill-mode

The comment (from 2002) is still there, but the mode was converted to
define-minor-mode in 2010.

> Is this mechanism still needed if `define-minor-mode' is used? Is it
> just for compatibility with XEmacs code and legacy code?

define-minor-mode has an equivalent :variable keyword, used, as in
this case, when it is preferable to get/set the mode variable
differently, or use another variable. It is not, AFAIK, because of
XEmacs compatibility, but cases where the variable is not just a
toggle; for example, overwrite-mode uses it too, and also the new
emacs-lock-mode that I committed a few days ago.

> How about documenting it - at least with a comment in the code
> somewhere: what is for, how and when to use it.

About :minor-mode-function, Stefan already answered you that should
not be used in new code, so nothing to document.

Is anything more to be done about this bug?

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#2470; Package emacs. (Sat, 09 Jul 2011 23:12:02 GMT) Full text and rfc822 format available.

Message #31 received at 2470 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juanma Barranquero'" <lekktu <at> gmail.com>
Cc: 2470 <at> debbugs.gnu.org
Subject: RE: bug#2470: 23.0.90; auto-fill-mode, :minor-mode-function
Date: Sat, 9 Jul 2011 16:10:59 -0700
> Is anything more to be done about this bug?

I guess not, if people have taken a look at it and done whatever they think
needed doing (if anything).

Would someone such as the person who posed the original question about how to
tell if this minor mode is on know now how to do that for `auto-fill-mode'?

That's really the question, I think.  Are things sufficiently clear (e.g. from
the doc) that a user would now know how to tell this?  I'll let you decide.  I
don't know what, if anything, has changed since the bug report was filed.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#2470; Package emacs. (Sat, 09 Jul 2011 23:20:02 GMT) Full text and rfc822 format available.

Message #34 received at 2470 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 2470 <at> debbugs.gnu.org
Subject: Re: bug#2470: 23.0.90; auto-fill-mode, :minor-mode-function
Date: Sun, 10 Jul 2011 01:18:49 +0200
On Sun, Jul 10, 2011 at 01:10, Drew Adams <drew.adams <at> oracle.com> wrote:

> I guess not, if people have taken a look at it and done whatever they think
> needed doing (if anything).

Codewise, I don't think there's anything to be done.

> Would someone such as the person who posed the original question about how to
> tell if this minor mode is on know now how to do that for `auto-fill-mode'?
>
> That's really the question, I think.  Are things sufficiently clear (e.g. from
> the doc) that a user would now know how to tell this?

Likely not, though strictly speaking, a user that needs to know the
variable name will usually be able to take a look at minor-mode-alist
and deduce it by himself.

In any case, could you please suggest a suitable change for the
docstring of auto-fill-mode?

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#2470; Package emacs. (Sun, 10 Jul 2011 09:56:02 GMT) Full text and rfc822 format available.

Message #37 received at 2470 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juanma Barranquero'" <lekktu <at> gmail.com>
Cc: 2470 <at> debbugs.gnu.org
Subject: RE: bug#2470: 23.0.90; auto-fill-mode, :minor-mode-function
Date: Sun, 10 Jul 2011 02:54:55 -0700
> > That's really the question, I think.  Are things 
> > sufficiently clear (e.g. from
> > the doc) that a user would now know how to tell this?
> 
> Likely not, though strictly speaking, a user that needs to know the
> variable name will usually be able to take a look at minor-mode-alist
> and deduce it by himself.
> 
> In any case, could you please suggest a suitable change for the
> docstring of auto-fill-mode?

I don't see a problem with that doc string in particular.
What did you have in mind?

This part is a little unclear:

"The value of `normal-auto-fill-function' specifies the function to use
for `auto-fill-function' when turning Auto Fill mode on."

One wonders why it speaks of `auto-fill-function', as if it is something
understood  (begs the question of its relation to `auto-fill-mode').

If you then click the `auto-fill-function' link you get doc on that function,
but it's not clear at all what it has to do with `auto-fill-mode'.

It does say also this: "auto-fill-function is also a variable."  But the name is
neither quoted (`...') nor a link to help on that var.  And there is nothing
saying  anything about what you said: that the variable tells you whether
`auto-fill-mode' is on (which was the OP question).

Perhaps we should at least add something like this to the `auto-fill-mode' doc:

"When `auto-fill-mode' is on, variable `auto-fill-function' is non-`nil'."





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#2470; Package emacs. (Sat, 16 Jul 2011 18:44:02 GMT) Full text and rfc822 format available.

Message #40 received at 2470 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 'Juanma Barranquero' <lekktu <at> gmail.com>, 2470 <at> debbugs.gnu.org
Subject: Re: bug#2470: 23.0.90; auto-fill-mode, :minor-mode-function
Date: Sat, 16 Jul 2011 20:43:03 +0200
"Drew Adams" <drew.adams <at> oracle.com> writes:

> Perhaps we should at least add something like this to the `auto-fill-mode' doc:
>
> "When `auto-fill-mode' is on, variable `auto-fill-function' is non-`nil'."

I've now added this.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Added tag(s) fixed. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 16 Jul 2011 18:44:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 24.1, send any further explanations to 2470 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 16 Jul 2011 18:44:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 14 Aug 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.