unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46193: Enabling Auto Fill mode
@ 2021-01-30 14:41 jai-bholeki
  2021-01-30 18:31 ` Philipp Stephani
  0 siblings, 1 reply; 6+ messages in thread
From: jai-bholeki @ 2021-01-30 14:41 UTC (permalink / raw)
  To: 46193


In the documentation for (auto-fill-mode &optional ARG), it says that
if called from Lisp, enable the mode if ARG is omitted or nil.

Enabling a mode using nil seems counter-intuitive to me.







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

* bug#46193: Enabling Auto Fill mode
  2021-01-30 14:41 bug#46193: Enabling Auto Fill mode jai-bholeki
@ 2021-01-30 18:31 ` Philipp Stephani
  2021-01-30 19:55   ` jai-bholeki
  2021-02-01  9:19   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Philipp Stephani @ 2021-01-30 18:31 UTC (permalink / raw)
  To: jai-bholeki; +Cc: 46193

Am Sa., 30. Jan. 2021 um 17:14 Uhr schrieb <jai-bholeki@gmx.com>:
>
>
> In the documentation for (auto-fill-mode &optional ARG), it says that
> if called from Lisp, enable the mode if ARG is omitted or nil.
>
> Enabling a mode using nil seems counter-intuitive to me.
>


Maybe, but it's the universal convention for minor modes. See "Minor
mode conventions" in the ELisp manual.





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

* bug#46193: Enabling Auto Fill mode
  2021-01-30 18:31 ` Philipp Stephani
@ 2021-01-30 19:55   ` jai-bholeki
  2021-02-01  9:20     ` Lars Ingebrigtsen
  2021-02-01  9:19   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 6+ messages in thread
From: jai-bholeki @ 2021-01-30 19:55 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: 46193

I have noticed that enabling a minor-mode using texinfo-mode-hook fails after
setting auto-fill comments using a hook.

(add-hook 'texinfo-mode-hook
	  (lambda () ((set (make-local-variable 'comment-auto-fill-only-comments) t)))
(auto-fill-mode)

;; crucible-mode not enabled after setting comment-auto-fill-only-comments
(add-hook 'texinfo-mode-hook 'crucible-mode)




> Sent: Sunday, January 31, 2021 at 6:31 AM
> From: "Philipp Stephani" <p.stephani2@gmail.com>
> To: jai-bholeki@gmx.com
> Cc: 46193@debbugs.gnu.org
> Subject: bug#46193: Enabling Auto Fill mode
>
> Am Sa., 30. Jan. 2021 um 17:14 Uhr schrieb <jai-bholeki@gmx.com>:
> >
> >
> > In the documentation for (auto-fill-mode &optional ARG), it says that
> > if called from Lisp, enable the mode if ARG is omitted or nil.
> >
> > Enabling a mode using nil seems counter-intuitive to me.
> >
>
>
> Maybe, but it's the universal convention for minor modes. See "Minor
> mode conventions" in the ELisp manual.
>
>
>
>





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

* bug#46193: Enabling Auto Fill mode
  2021-01-30 18:31 ` Philipp Stephani
  2021-01-30 19:55   ` jai-bholeki
@ 2021-02-01  9:19   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-01  9:19 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: 46193, jai-bholeki

Philipp Stephani <p.stephani2@gmail.com> writes:

> Am Sa., 30. Jan. 2021 um 17:14 Uhr schrieb <jai-bholeki@gmx.com>:
>>
>> In the documentation for (auto-fill-mode &optional ARG), it says that
>> if called from Lisp, enable the mode if ARG is omitted or nil.
>>
>> Enabling a mode using nil seems counter-intuitive to me.
>
> Maybe, but it's the universal convention for minor modes. See "Minor
> mode conventions" in the ELisp manual.

Indeed, so I'm closing this bug report.

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





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

* bug#46193: Enabling Auto Fill mode
  2021-01-30 19:55   ` jai-bholeki
@ 2021-02-01  9:20     ` Lars Ingebrigtsen
  2021-02-01 11:59       ` jai-bholeki
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-01  9:20 UTC (permalink / raw)
  To: jai-bholeki; +Cc: 46193, Philipp Stephani

jai-bholeki@gmx.com writes:

> I have noticed that enabling a minor-mode using texinfo-mode-hook fails after
> setting auto-fill comments using a hook.
>
> (add-hook 'texinfo-mode-hook
> 	  (lambda () ((set (make-local-variable
> 'comment-auto-fill-only-comments) t)))
> (auto-fill-mode)
>
> ;; crucible-mode not enabled after setting comment-auto-fill-only-comments
> (add-hook 'texinfo-mode-hook 'crucible-mode)

(add-hook 'texinfo-mode-hook
	  (lambda () ((set (make-local-variable 'comment-auto-fill-only-comments) t)))

That's not valid syntax -- you have one extra pair of () around the
`set' function call.

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





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

* bug#46193: Enabling Auto Fill mode
  2021-02-01  9:20     ` Lars Ingebrigtsen
@ 2021-02-01 11:59       ` jai-bholeki
  0 siblings, 0 replies; 6+ messages in thread
From: jai-bholeki @ 2021-02-01 11:59 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 46193, Philipp Stephani

I have now made the following function.  Would I better make the
functionality to be buffer-local?

(defvar dfv-break-long-lines-state nil)

(defun cycle-break-long-lines-din ()
  "Breaks long lines using auto-fill tool."
  (interactive)
  ;;
  (pcase dfv-break-long-lines-state
    ;;
    (1 (setq fill-column 72)
       (setq comment-auto-fill-only-comments t)
       (auto-fill-mode)
       (message "%s" "Enable: Break only comments")
       (setq dfv-break-long-lines-state 2))
    ;;
    (2 (setq comment-auto-fill-only-comments nil)
       (message "%s" "Enable: Break all long lines")
       (setq dfv-break-long-lines-state 1))
    ;;
    (_ (setq comment-auto-fill-only-comments nil)
       (auto-fill-mode 0)
       (message "%s" "Disable: Break long lines")
       (setq dfv-break-long-lines-state 0)) ))

(defun break-long-lines-din ()
  "Breaks long lines using auto-fill."
  (setq dfv-break-long-lines-state 1)
  (cycle-break-long-lines-din))



> Sent: Monday, February 01, 2021 at 9:20 PM
> From: "Lars Ingebrigtsen" <larsi@gnus.org>
> To: jai-bholeki@gmx.com
> Cc: "Philipp Stephani" <p.stephani2@gmail.com>, 46193@debbugs.gnu.org
> Subject: Re: bug#46193: Enabling Auto Fill mode
>
> jai-bholeki@gmx.com writes:
>
> > I have noticed that enabling a minor-mode using texinfo-mode-hook fails after
> > setting auto-fill comments using a hook.
> >
> > (add-hook 'texinfo-mode-hook
> > 	  (lambda () ((set (make-local-variable
> > 'comment-auto-fill-only-comments) t)))
> > (auto-fill-mode)
> >
> > ;; crucible-mode not enabled after setting comment-auto-fill-only-comments
> > (add-hook 'texinfo-mode-hook 'crucible-mode)
>
> (add-hook 'texinfo-mode-hook
> 	  (lambda () ((set (make-local-variable 'comment-auto-fill-only-comments) t)))
>
> That's not valid syntax -- you have one extra pair of () around the
> `set' function call.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>





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

end of thread, other threads:[~2021-02-01 11:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-30 14:41 bug#46193: Enabling Auto Fill mode jai-bholeki
2021-01-30 18:31 ` Philipp Stephani
2021-01-30 19:55   ` jai-bholeki
2021-02-01  9:20     ` Lars Ingebrigtsen
2021-02-01 11:59       ` jai-bholeki
2021-02-01  9:19   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).