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

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

Re: Removing line and column number settings from some buffers


From: daniela-spit
Subject: Re: Removing line and column number settings from some buffers
Date: Sat, 5 Dec 2020 23:54:51 +0100

Look at this code.  Correct, you don't need a variable for storing,
but what is happening with n in the following code.

The byte compiler complains about the variable n

(defun auto-fill-cycle ()
   "Cycles Auto Fill.  Automatically breaks lines that get beyond
variable fill-column."
   (interactive)

   ;; ----- body of let -----
;;   (unless (get 'auto-fill-cycle 'state)
;;      (put 'auto-fill-cycle 'state 1))

   (setq-local n (get '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 'auto-fill-cycle 'state 2))
   (when (= n 2)
      (message "Auto Fill Whole Buffer")
      (set (make-local-variable 'comment-auto-fill-only-comments) nil)
      (put 'auto-fill-cycle 'state 3))
   (when (= n 3)
      (message "Disable Auto Fill")
      (auto-fill-mode 0)
      (put 'auto-fill-cycle 'state 1)) )

(global-set-key (kbd "H-a") #'auto-fill-cycle)




> Sent: Saturday, December 05, 2020 at 10:35 PM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: daniela-spit@gmx.it
> Cc: "Christopher Dimech" <dimech@gmx.com>, help-gnu-emacs@gnu.org
> Subject: Re: Removing line and column number settings from some buffers
>
> daniela-spit@gmx.it writes:
>
> > One problem is how to store (get 'time-frmt-cycle 'state) in a
> > variable.
>
> If you save the state already in the state property of `time-frmt-cycle'
> you don't need a variable for storing.  What specifically is your
> question?
>
> Michael.
>



reply via email to

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