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

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

Re: Cycle Auto-Fill


From: Christopher Dimech
Subject: Re: Cycle Auto-Fill
Date: Sat, 5 Dec 2020 15:16:15 +0100

The change gives the error.  Although the modified version looks reasonable to 
me.

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  =(nil 2)

> Sent: Saturday, December 05, 2020 at 2:59 PM
> From: "Pankaj Jangid" <pankaj@codeisgreat.org>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Cycle Auto-Fill
>
> Christopher Dimech <dimech@gmx.com> writes:
>
> > (defun gungadin-auto-fill-cycle ()
> >    "Cycles Auto Fill.  Automatically breaks lines that get beyond
> > variable fill-column."
> >    (interactive)
>
> -    (unless (get 'gungadin-auto-fill-cycle 'state)
> -       (put 'gungadin-auto-fill-cycle 'state 1))
>
> >
> >    (setq n (get 'gungadin-auto-fill-cycle 'state))
> >
>
> -    (when (= n 1)
> +    (when (or (not n) (= n 1))
>
> >       (message "Auto Fill Comments Only")
> >       (set (make-local-variable 'comment-auto-fill-only-comments) t)
> >       (auto-fill-mode 1)
> >       (put 'gungadin-auto-fill-cycle 'state 2))
> >    (when (= n 2)
> >       (message "Auto Fill Buffer")
> >       (set (make-local-variable 'comment-auto-fill-only-comments) nil)
> >       (put 'gungadin-auto-fill-cycle 'state 3))
> >    (when (= n 3)
> >       (message "Disable Auto Fill")
> >       (auto-fill-mode 0)
> >       (put 'gungadin-auto-fill-cycle 'state 1)) )
> >
> > (global-set-key (kbd "H-a") #'gungadin-auto-fill-cycle)
>
> Will this work?
>
> Removed one (get) call and a conditional test. Added one conditional
> test.
>



reply via email to

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