help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to find the status of auto-fill-mode in a buffer


From: Eli Zaretskii
Subject: Re: Trying to find the status of auto-fill-mode in a buffer
Date: Sat, 23 Nov 2024 11:37:56 +0200

> 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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]