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

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

bug#46193: Enabling Auto Fill mode


From: jai-bholeki
Subject: bug#46193: Enabling Auto Fill mode
Date: Mon, 1 Feb 2021 12:59:25 +0100

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
>





reply via email to

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