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

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

Re: Why didn't setq work here?


From: Eric Lilja
Subject: Re: Why didn't setq work here?
Date: Fri, 07 Jan 2011 17:05:48 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

On 2011-01-07 15:26, Tassilo Horn wrote:
Eric Lilja<mindcooler@gmail.com>  writes:

I have one final question though. fill-column does seem to be a
variable.

It is.

It can be described using C-h v and set using M-x
set-variable. However, if I replace (set-fill-column 76) with (setq
fill-column 76) the variable value is never changed (and no byte
compiler warning btw).

I presume, your observation is false.  In fact, `set-fill-column' does
nothing except reading its argument and then doing (setq fill-column
arg) itself.

Bye,
Tassilo




Thanks for your reply Mr Horn. Either my mind is playing tricks on me or there is some stochastic error here which makes setq sometimes not stick. I tried it ten times in a row and one time it claimed fill-column was at the default value. Anyway, I documented my .emacs like the following and I now consider this case closed. I learned quite a bit about configuring emacs in this little thread so I am happy! I will look out for set-fill-column not "sticking" as it should if my brain was indeed not fooling me.

(defun my-latex-hook ()
  (message "Running my-latex-hook")
  ;; Using setq does not work, because setq is for setting values of
  ;; variables and there is no variable called auto-fill-mode (as can
  ;; be observed by performing C-h v auto-fill-mode). The correct way
  ;; to turn on auto-fill-mode is to call the funcion auto-fill-mode
  ;; with a positive argument. In some modes there exists a variable
  ;; with the same name as the function which disables or enables that
  ;; mode (a variable that can be used for the same purpose), but
  ;; auto-fill-mode is not one of those modes.
  (auto-fill-mode 1)
  ;; fill-column is a variable so we can use setq on it. However, we
  ;; have decided to use the function set-fill-column which performs
  ;; setq fill-column itself but also displays in the messages buffer
  ;; what it's doing.
  ;; Sometimes it seemed like setq fill-column did not take effect
  ;; as it should but it could just be my imagination...
  (set-fill-column 76)
)
(add-hook 'latex-mode-hook 'my-latex-hook)

- EL




reply via email to

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