[Top][All Lists]

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

Re: turning line mode on/off with defun not working

From: Emanuel Berg
Subject: Re: turning line mode on/off with defun not working
Date: Fri, 06 Dec 2013 19:35:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Wes James <address@hidden> writes:

> I have these lines in my .emacs, but they don't
> work. Why?

(interactive), for starters. But you probably won't to
enable this buffer-local. Also, check out the below
Elisp for two simple "toggle" defuns - you don't need
one to turn it off, and one to turn it on - think of it
as a binary state machine (i.e., with two states). It
only requires one operation, "do whatever I don't do

;;; show point position
;; column
(defun char-mode ()
  "Mode bar: Show the index of the character at point (first = 0)."
  (set-variable 'column-number-mode
                (not column-number-mode)
                t) ) ; local
(defalias 'cols 'char-mode)
;; line
(defun line-mode ()
  "Mode bar: Show the line number at point (first = 1)."
  (set-variable 'line-number-mode
                (not line-number-mode)
                t) ) ; local
(defalias 'lines 'line-mode)

Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu
underground experts united:

reply via email to

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