* incompatible change of toogle-truncate-lines
@ 2006-05-24 16:43 Reiner Steib
2006-05-24 18:04 ` Stefan Monnier
2006-05-25 0:37 ` Richard Stallman
0 siblings, 2 replies; 3+ messages in thread
From: Reiner Steib @ 2006-05-24 16:43 UTC (permalink / raw)
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: incompatible change of toogle-truncate-lines
2006-05-24 16:43 incompatible change of toogle-truncate-lines Reiner Steib
@ 2006-05-24 18:04 ` Stefan Monnier
2006-05-25 0:37 ` Richard Stallman
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2006-05-24 18:04 UTC (permalink / raw)
> 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?
Sounds like the right thing to do, indeed.
> 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.)
Although your fix is much better, a generic answer to this question could
look like:
(condition-case nil
(toggle-truncate-lines t)
(wrong-number-of-arguments (toggle-truncate-lines)))
-- Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: incompatible change of toogle-truncate-lines
2006-05-24 16:43 incompatible change of toogle-truncate-lines Reiner Steib
2006-05-24 18:04 ` Stefan Monnier
@ 2006-05-25 0:37 ` Richard Stallman
1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2006-05-25 0:37 UTC (permalink / raw)
Cc: emacs-devel
-(defun toggle-truncate-lines (arg)
+(defun toggle-truncate-lines (&optional arg)
Please do it.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-05-25 0:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-24 16:43 incompatible change of toogle-truncate-lines Reiner Steib
2006-05-24 18:04 ` Stefan Monnier
2006-05-25 0:37 ` Richard Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.