emacs-devel
[Top][All Lists]
Advanced

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

incompatible change of toogle-truncate-lines


From: Reiner Steib
Subject: incompatible change of toogle-truncate-lines
Date: Wed, 24 May 2006 18:43:24 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Hi,

I'd like to use `toogle-truncate-lines' in a Gnus command to toggle
long lines in the article buffer.

Unfortunately the defun in Emacs 21 [1] accepts no argument and the
version in Emacs 22 [2] must be called with one argument.

Is there any problem with making ARG optional in Emacs 22?  May I
install this patch?

--8<---------------cut here---------------start------------->8---
--- simple.el   23 May 2006 00:49:55 -0000      1.805
+++ simple.el   24 May 2006 16:37:51 -0000
@@ -4247,7 +4247,7 @@
 (defvaralias 'indicate-unused-lines 'indicate-empty-lines)
 (defvaralias 'default-indicate-unused-lines 'default-indicate-empty-lines)
 
-(defun toggle-truncate-lines (arg)
+(defun toggle-truncate-lines (&optional arg)
   "Toggle whether to fold or truncate long lines on the screen.
 With arg, truncate long lines iff arg is positive.
 Note that in side-by-side windows, truncation is always enabled."
--8<---------------cut here---------------end--------------->8---

If not: Is there a simple way to check if `toogle-truncate-lines'
expects zero or one arguments?  (Well, I could check
`emacs-major-version', but that's ugly.)

Bye, Reiner.

[1]
,----[ <f1> f toggle-truncate-lines RET / Emacs 21 ]
| toggle-truncate-lines is an interactive compiled Lisp function.
| (toggle-truncate-lines)
| 
| Toggle whether to truncate long lines on the screen.
`----

In Emacs 21 it is defined using `menu-bar-make-toggle' [3].

[2]
,----[ <f1> f toggle-truncate-lines RET / Emacs 22 ]
| toggle-truncate-lines is an interactive compiled Lisp function in `simple.el'.
| It is bound to <menu-bar> <options> <truncate-lines>.
| (toggle-truncate-lines ARG)
| 
| Toggle whether to fold or truncate long lines on the screen.
| With ARG, truncate long lines iff ARG is positive.
| Note that in side-by-side windows, truncation is always enabled.
`----

[3]
(defmacro menu-bar-make-toggle (name variable doc message help &rest body)
  `(progn
     (defun ,name ()
       ,(concat "Toggle whether to " (downcase (substring help 0 1))
                (substring help 1) ".")
       (interactive)
       (if ,(if body `(progn . ,body)
              `(setq ,variable (not ,variable)))
           (message ,message "enabled")
         (message ,message "disabled")))
     '(menu-item ,doc ,name
                 :help ,help
                 :button (:toggle . (and (boundp ',variable) ,variable)))))


-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/





reply via email to

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