all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Trying to find the status of auto-fill-mode in a buffer
@ 2024-11-19  6:43 Alexandros Prekates
  2024-11-19  9:39 ` Arsen Arsenović
  0 siblings, 1 reply; 19+ messages in thread
From: Alexandros Prekates @ 2024-11-19  6:43 UTC (permalink / raw)
  To: help-gnu-emacs

C-h f auto-fill-mode says : 
  ''To check whether the minor mode is
  enabled in the current buffer, evaluate ‘auto-fill-function’. ''

How do we test that IN a certain buffer ? 
I evaluated (auto-fill-function) in scratch buffer
but it gives me nil. 

Alexandros 



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19  6:43 Alexandros Prekates
@ 2024-11-19  9:39 ` Arsen Arsenović
  2024-11-19  9:49   ` Alexandros Prekates
  0 siblings, 1 reply; 19+ messages in thread
From: Arsen Arsenović @ 2024-11-19  9:39 UTC (permalink / raw)
  To: Alexandros Prekates; +Cc: help-gnu-emacs

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

Alexandros Prekates <aprekates@posteo.net> writes:

> C-h f auto-fill-mode says : 
>   ''To check whether the minor mode is
>   enabled in the current buffer, evaluate ‘auto-fill-function’. ''
>
> How do we test that IN a certain buffer ? 
> I evaluated (auto-fill-function) in scratch buffer
> but it gives me nil. 

Right, but the docstring tells you to evaluate `auto-fill-function', not
`(auto-fill-function)'.  Indeed, it is a variable.

Example from my scratch buffer:

--8<---------------cut here---------------start------------->8---
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with ‘C-x C-f’ and enter text in its buffer.

auto-fill-function
do-auto-fill
--8<---------------cut here---------------end--------------->8---

HTH, have a lovely day.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19  9:39 ` Arsen Arsenović
@ 2024-11-19  9:49   ` Alexandros Prekates
  2024-11-19 10:35     ` Tassilo Horn
                       ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Alexandros Prekates @ 2024-11-19  9:49 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 19 Nov 2024 10:39:22 +0100
Arsen Arsenović <arsen@aarsen.me> wrote:

> Alexandros Prekates <aprekates@posteo.net> writes:
> 
> > C-h f auto-fill-mode says : 
> >   ''To check whether the minor mode is
> >   enabled in the current buffer, evaluate ‘auto-fill-function’. ''
> >
> > How do we test that IN a certain buffer ? 
> > I evaluated (auto-fill-function) in scratch buffer
> > but it gives me nil. 
> 
> Right, but the docstring tells you to evaluate `auto-fill-function',
> not `(auto-fill-function)'.  Indeed, it is a variable.
> 
> Example from my scratch buffer:
> 
> --8<---------------cut here---------------start------------->8---
> ;; This buffer is for text that is not saved, and for Lisp evaluation.
> ;; To create a file, visit it with ‘C-x C-f’ and enter text in its
> buffer.
> 
> auto-fill-function
> do-auto-fill
> --8<---------------cut here---------------end--------------->8---
> 
> HTH, have a lovely day.

Thank you. 
It seemed like little a riddle!!  Evaluate a variable that has function
in its name. 

But how do we use scratch a classic REPL ? I mean if a was in a clisp
repl it may had occured me to 'evaluate' a variable. But by default
scratch is not a repl. 
I indeed evaluated as you said auto-fill-function but i get my result
in the echo area.

Also how evaluating a variable in scratch the scratch nows for which
buffer we asked for ?

Alexandros



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19  9:49   ` Alexandros Prekates
@ 2024-11-19 10:35     ` Tassilo Horn
  2024-11-19 14:16       ` Alexandros Prekates
  2024-11-19 11:27     ` Robert Pluim
                       ` (4 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Tassilo Horn @ 2024-11-19 10:35 UTC (permalink / raw)
  To: Alexandros Prekates; +Cc: help-gnu-emacs

Alexandros Prekates <aprekates@posteo.net> writes:

> But how do we use scratch a classic REPL ? I mean if a was in a clisp
> repl it may had occured me to 'evaluate' a variable. But by default
> scratch is not a repl. 
> I indeed evaluated as you said auto-fill-function but i get my result
> in the echo area.
>
> Also how evaluating a variable in scratch the scratch nows for which
> buffer we asked for ?

Buffer-local variables are evaluated in the current buffer which might
be *scratch*.  So ensure you make the buffer you are interested in
current, e.g., by evaluating this in *scratch*:

--8<---------------cut here---------------start------------->8---
(with-current-buffer "*Messages*"
  auto-fill-function)
;;=> nil
--8<---------------cut here---------------end--------------->8---

HTH,
Tassilo



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19  9:49   ` Alexandros Prekates
  2024-11-19 10:35     ` Tassilo Horn
@ 2024-11-19 11:27     ` Robert Pluim
  2024-11-19 14:52     ` Arsen Arsenović
                       ` (3 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Robert Pluim @ 2024-11-19 11:27 UTC (permalink / raw)
  To: Alexandros Prekates; +Cc: help-gnu-emacs

>>>>> On Tue, 19 Nov 2024 09:49:09 +0000, Alexandros Prekates <aprekates@posteo.net> said:
    Alexandros> But how do we use scratch a classic REPL ? I mean if a was in a clisp
    Alexandros> repl it may had occured me to 'evaluate' a variable. But by default
    Alexandros> scratch is not a repl. 

If you want an elisp REPL then you need 'M-x ielm' (which also allows
you to specify which buffer to use to when evaluating code).

Robert
-- 



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19 10:35     ` Tassilo Horn
@ 2024-11-19 14:16       ` Alexandros Prekates
  0 siblings, 0 replies; 19+ messages in thread
From: Alexandros Prekates @ 2024-11-19 14:16 UTC (permalink / raw)
  To: help-gnu-emacs


Tassilo and Robert thank you both.



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19  9:49   ` Alexandros Prekates
  2024-11-19 10:35     ` Tassilo Horn
  2024-11-19 11:27     ` Robert Pluim
@ 2024-11-19 14:52     ` Arsen Arsenović
  2024-11-19 17:25     ` Michael Heerdegen via Users list for the GNU Emacs text editor
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Arsen Arsenović @ 2024-11-19 14:52 UTC (permalink / raw)
  To: Alexandros Prekates; +Cc: help-gnu-emacs

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

Hi,

Alexandros Prekates <aprekates@posteo.net> writes:

> Thank you. 
> It seemed like little a riddle!!  Evaluate a variable that has function
> in its name. 

A bit confusing, yes ;)

> But how do we use scratch a classic REPL ? I mean if a was in a clisp
> repl it may had occured me to 'evaluate' a variable. But by default
> scratch is not a repl.

It is: if you hit C-j it evaluates the previous s-expr.

> I indeed evaluated as you said auto-fill-function but i get my result
> in the echo area.
>
> Also how evaluating a variable in scratch the scratch nows for which
> buffer we asked for ?

As others have answered, using `with-current-buffer'.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19  9:49   ` Alexandros Prekates
                       ` (2 preceding siblings ...)
  2024-11-19 14:52     ` Arsen Arsenović
@ 2024-11-19 17:25     ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-11-19 17:38     ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-11-20 18:51     ` mbork
  5 siblings, 0 replies; 19+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-11-19 17:25 UTC (permalink / raw)
  To: help-gnu-emacs

Alexandros Prekates <aprekates@posteo.net> writes:

> But how do we use scratch a classic REPL ? I mean if a was in a clisp
> repl it may had occured me to 'evaluate' a variable. But by default
> scratch is not a repl. 

Just do M-: auto-fill-function.  M-: evals in the context of the current
buffer, so when you do it with the *scratch* buffer current you will get
the buffer local binding of the variable in *scratch* printed.

Michael.




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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19  9:49   ` Alexandros Prekates
                       ` (3 preceding siblings ...)
  2024-11-19 17:25     ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-11-19 17:38     ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-11-20  7:56       ` Robert Pluim
  2024-11-20 18:51     ` mbork
  5 siblings, 1 reply; 19+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-11-19 17:38 UTC (permalink / raw)
  To: help-gnu-emacs

Alexandros Prekates <aprekates@posteo.net> writes:

> > > C-h f auto-fill-mode says : 
> > >   ''To check whether the minor mode is
> > >   enabled in the current buffer, evaluate ‘auto-fill-function’. ''
> > >
> > > How do we test that IN a certain buffer ? 
> > > I evaluated (auto-fill-function) in scratch buffer
> > > but it gives me nil. 

> It seemed like little a riddle!!  Evaluate a variable that has function
> in its name. 

The code that generates this particular output is relatively new (a
couple of months).

In the general case, what has to be evaluated can potentially be any
kind of expression, but maybe we could find a better wording in the
special case where the expression is a variable, like here.

Maybe "look at the binding of VAR" or something like that.  Would that
have been less confusing?


Michael.




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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19 17:38     ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-11-20  7:56       ` Robert Pluim
  2024-11-20 16:05         ` Michael Heerdegen via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 19+ messages in thread
From: Robert Pluim @ 2024-11-20  7:56 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Michael Heerdegen

>>>>> On Tue, 19 Nov 2024 18:38:41 +0100, Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> said:
    Michael> In the general case, what has to be evaluated can potentially be any
    Michael> kind of expression, but maybe we could find a better wording in the
    Michael> special case where the expression is a variable, like here.

    Michael> Maybe "look at the binding of VAR" or something like that.  Would that
    Michael> have been less confusing?

"whatʼs a binding?" (yes, Iʼm playing devilʼs advocate).

Robert
-- 



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-20  7:56       ` Robert Pluim
@ 2024-11-20 16:05         ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-11-20 16:14           ` Robert Pluim
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-11-20 16:05 UTC (permalink / raw)
  To: help-gnu-emacs

Robert Pluim <rpluim@gmail.com> writes:

> Michael> Maybe "look at the binding of VAR" or something like
> Michael> that.  Would that
> Michael> have been less confusing?
>
> "whatʼs a binding?" (yes, Iʼm playing devilʼs advocate).

Isn't that common language, though?  Which wording would that advocate
prefer instead?


Thx,

Michael.




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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-20 16:05         ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-11-20 16:14           ` Robert Pluim
  2024-11-20 19:14             ` Michael Heerdegen via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 19+ messages in thread
From: Robert Pluim @ 2024-11-20 16:14 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Michael Heerdegen

>>>>> On Wed, 20 Nov 2024 17:05:41 +0100, Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> said:

    Michael> Robert Pluim <rpluim@gmail.com> writes:
    Michael> Maybe "look at the binding of VAR" or something like
    Michael> that.  Would that
    Michael> have been less confusing?
    >> 
    >> "whatʼs a binding?" (yes, Iʼm playing devilʼs advocate).

    Michael> Isn't that common language, though?  Which wording would that advocate
    Michael> prefer instead?

I just meant that someone starting out with Emacs is unlikely to
understand what is meant by it (unless theyʼre already versed in
lisp). So 'value' is probably best, but if we change the text to say
"look at the value of the variable auto-fill-function", we will then
get "How do I do that?" :-) (and not everyone realises you can click
on the variable name or press RET on it)

Robert
-- 



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-19  9:49   ` Alexandros Prekates
                       ` (4 preceding siblings ...)
  2024-11-19 17:38     ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-11-20 18:51     ` mbork
  5 siblings, 0 replies; 19+ messages in thread
From: mbork @ 2024-11-20 18:51 UTC (permalink / raw)
  To: Alexandros Prekates; +Cc: help-gnu-emacs

On 2024-11-19, at 09:49, Alexandros Prekates <aprekates@posteo.net> wrote:

> It seemed like little a riddle!!  Evaluate a variable that has function
> in its name. 

See also
https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html:

> If the purpose of a variable is to store a single function, give it a
> name that ends in ‘-function’.

Best,

-- 
Marcin Borkowski
https://mbork.pl
https://crimsonelevendelightpetrichor.net/



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-20 16:14           ` Robert Pluim
@ 2024-11-20 19:14             ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-11-20 19:27               ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-11-20 19:14 UTC (permalink / raw)
  To: help-gnu-emacs

Robert Pluim <rpluim@gmail.com> writes:

> I just meant that someone starting out with Emacs is unlikely to
> understand what is meant by it (unless theyʼre already versed in
> lisp). So 'value' is probably best, but if we change the text to say
> "look at the value of the variable auto-fill-function", we will then
> get "How do I do that?" :-) (and not everyone realises you can click
> on the variable name or press RET on it)

I see it a bit differently: the current wording in this case uses an
artificial, unnatural language, like "to find out how many people came
to the party, evaluate `3'".  That's also why it's unnecessarily
confusing.

"Value" is something I would avoid, especially in this context where
buffer local bindings are involved.  "Binding of VAR" is a wording we
use all over the place, for example in the manual.  One can could look
it up.  To understand what is going on one has to be a bit familiar with
the basic concepts (like buffer local bindings) anyway, so I see no
reason not to use the language associated with these concepts.

And this sentence is not there to answer all questions.  We just should
avoid directing people in a wrong direction.

Michael.




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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-20 19:14             ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-11-20 19:27               ` Eli Zaretskii
  2024-11-20 23:50                 ` Michael Heerdegen via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2024-11-20 19:27 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Wed, 20 Nov 2024 20:14:09 +0100
> From:  Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> Robert Pluim <rpluim@gmail.com> writes:
> 
> > I just meant that someone starting out with Emacs is unlikely to
> > understand what is meant by it (unless theyʼre already versed in
> > lisp). So 'value' is probably best, but if we change the text to say
> > "look at the value of the variable auto-fill-function", we will then
> > get "How do I do that?" :-) (and not everyone realises you can click
> > on the variable name or press RET on it)
> 
> I see it a bit differently: the current wording in this case uses an
> artificial, unnatural language, like "to find out how many people came
> to the party, evaluate `3'".  That's also why it's unnecessarily
> confusing.
> 
> "Value" is something I would avoid, especially in this context where
> buffer local bindings are involved.  "Binding of VAR" is a wording we
> use all over the place, for example in the manual.  One can could look
> it up.  To understand what is going on one has to be a bit familiar with
> the basic concepts (like buffer local bindings) anyway, so I see no
> reason not to use the language associated with these concepts.
> 
> And this sentence is not there to answer all questions.  We just should
> avoid directing people in a wrong direction.

Let me turn the table and ask what's wrong with "evaluate the
variable"?  If we are afraid that people will not know how to evaluate
a variable, all we need is to mention the name of the command and
perhaps also its key binding.  If there are other problems with the
current wording, please identify them.



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-20 19:27               ` Eli Zaretskii
@ 2024-11-20 23:50                 ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-11-21  6:50                   ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-11-20 23:50 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

> Let me turn the table and ask what's wrong with "evaluate the
> variable"?

Good question! - thanks.

The original post contained this wording:

> > C-h f auto-fill-mode says : 
> >   ''To check whether the minor mode is
> >   enabled in the current buffer, evaluate ‘auto-fill-function’. ''

At least in master one gets:

| To check whether the minor mode is enabled in the current buffer,
| evaluate the variable ‘auto-fill-function’.

which is (as opposed to the first version) ok to me.  "Check
the binding" would be a bit better IMO, but I don't find anything
confusing in the current wording.  I should have checked earlier.


Michael.




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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-20 23:50                 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-11-21  6:50                   ` Eli Zaretskii
  0 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2024-11-21  6:50 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Thu, 21 Nov 2024 00:50:08 +0100
> From:  Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> The original post contained this wording:
> 
> > > C-h f auto-fill-mode says : 
> > >   ''To check whether the minor mode is
> > >   enabled in the current buffer, evaluate ‘auto-fill-function’. ''
> 
> At least in master one gets:
> 
> | To check whether the minor mode is enabled in the current buffer,
> | evaluate the variable ‘auto-fill-function’.
> 
> which is (as opposed to the first version) ok to me.  "Check
> the binding" would be a bit better IMO, but I don't find anything
> confusing in the current wording.  I should have checked earlier.

The wording on the emacs-30 release branch is identical to what you
see on master, which means that all the future Emacs releases will
mention the variable part.



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

* Re: Trying to find the status of auto-fill-mode in a buffer
@ 2024-11-23  9:22 Alexandros Prekates
  2024-11-23  9:37 ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Alexandros Prekates @ 2024-11-23  9:22 UTC (permalink / raw)
  To: help-gnu-emacs

Regarding the discussion about the naming, i dont have the experience
in lisp and elisp but i think i can try to convey what perhaps is
the difficulty here for me as a newbie.

the C-h f auto-fill-mode says 
  To check whether the minor mode is enabled in the current buffer,
     ^^^^^                           ^^^^^^^        ^^^^^^^^^^^^^^^
   evaluate (the variable) ‘auto-fill-function’
   ^^^^^^^^   (+master)          ^^^^^^^^

So on one hand i think it would be reasonable my mind to think of a
state-like variable (not a function) . In that state i think
a boolean variable auto-fill-mode-activation-state would make more
sense to me. 

But then i think i step into a possible semanticaly foggy area. Emacs
tells  me that to find the state of a minor mode lets:
'evaluate' sth called 'auto-fill-function'
Reading the current discussion and reading more carefully :
C-h f auto-fill-mode 
C-h v auto-fill-function
       auto-fill-function is a variable defined in ‘C source code’.
C-v f auto-fill-function 
      auto-fill-function is a native-compiled Lisp function in
    ‘simple.el’. 
and do-auto-fill is a native-compiled Lisp function in ‘simple.el’


What i understand vaguely is that emacs uses the value of a variable
that holds or points to the function that does the actual auto-fill
and if it has nil value that means that the mode is not active in the
current buffer.(i wonder if that is an idiosyncratic way to tell if 
a mode is active or used often). 
But i get the feeling (a hunch) that we are in a borderline world
where C land semantics mix with the Lisp land ones. 
For example i dont see the word 'symbol'.


----------
Thanks to Marcin for bringing to my attention the coding convention
regarding 'auto-fill-function'.

Thanks to Arsen for bringing to my attention C-j.

As for M-: that Michael suggested i have currently a keyboard
conflict that wont allow me to enter that key.


 



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

* Re: Trying to find the status of auto-fill-mode in a buffer
  2024-11-23  9:22 Trying to find the status of auto-fill-mode in a buffer Alexandros Prekates
@ 2024-11-23  9:37 ` Eli Zaretskii
  0 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2024-11-23  9:37 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 23 Nov 2024 09:22:57 +0000
> From: Alexandros Prekates <aprekates@posteo.net>
> 
> Regarding the discussion about the naming, i dont have the experience
> in lisp and elisp but i think i can try to convey what perhaps is
> the difficulty here for me as a newbie.
> 
> the C-h f auto-fill-mode says 
>   To check whether the minor mode is enabled in the current buffer,
>      ^^^^^                           ^^^^^^^        ^^^^^^^^^^^^^^^
>    evaluate (the variable) ‘auto-fill-function’
>    ^^^^^^^^   (+master)          ^^^^^^^^
> 
> So on one hand i think it would be reasonable my mind to think of a
> state-like variable (not a function) . In that state i think
> a boolean variable auto-fill-mode-activation-state would make more
> sense to me. 

But there's no such state variable in this case.

> But then i think i step into a possible semanticaly foggy area. Emacs
> tells  me that to find the state of a minor mode lets:
> 'evaluate' sth called 'auto-fill-function'
> Reading the current discussion and reading more carefully :
> C-h f auto-fill-mode 
> C-h v auto-fill-function
>        auto-fill-function is a variable defined in ‘C source code’.
> C-v f auto-fill-function 
>       auto-fill-function is a native-compiled Lisp function in
>     ‘simple.el’. 
> and do-auto-fill is a native-compiled Lisp function in ‘simple.el’
> 
> 
> What i understand vaguely is that emacs uses the value of a variable
> that holds or points to the function that does the actual auto-fill
> and if it has nil value that means that the mode is not active in the
> current buffer.(i wonder if that is an idiosyncratic way to tell if 
> a mode is active or used often). 

The text displayed by "C-h v auto-fill-function RET" in a buffer
where auto-fill is not turned on is the following:

  auto-fill-function is a variable defined in ‘C source code’.

  Its value is nil

  Function called (if non-nil) to perform auto-fill.

while in a buffer where the mode is turned on, the text is:

  auto-fill-function is a variable defined in ‘C source code’.

  Its value is ‘mail-mode-auto-fill’
  Local in buffer *mail*; global value is nil

  Function called (if non-nil) to perform auto-fill.

This tells to me that if the value is non-nil, the mode is turned on,
and Emacs performs auto-filling using that function, otherwise it is
turned off and no auto-filling takes place.  I don't find the above to
be vague at all.

> But i get the feeling (a hunch) that we are in a borderline world
> where C land semantics mix with the Lisp land ones. 
> For example i dont see the word 'symbol'.

How do you get that feeling and why?



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

end of thread, other threads:[~2024-11-23  9:37 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-23  9:22 Trying to find the status of auto-fill-mode in a buffer Alexandros Prekates
2024-11-23  9:37 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2024-11-19  6:43 Alexandros Prekates
2024-11-19  9:39 ` Arsen Arsenović
2024-11-19  9:49   ` Alexandros Prekates
2024-11-19 10:35     ` Tassilo Horn
2024-11-19 14:16       ` Alexandros Prekates
2024-11-19 11:27     ` Robert Pluim
2024-11-19 14:52     ` Arsen Arsenović
2024-11-19 17:25     ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-11-19 17:38     ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-11-20  7:56       ` Robert Pluim
2024-11-20 16:05         ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-11-20 16:14           ` Robert Pluim
2024-11-20 19:14             ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-11-20 19:27               ` Eli Zaretskii
2024-11-20 23:50                 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-11-21  6:50                   ` Eli Zaretskii
2024-11-20 18:51     ` mbork

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.