* bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil
@ 2013-01-12 17:58 Michael Heerdegen
2013-01-12 20:19 ` Andreas Schwab
2013-01-13 0:34 ` Stefan Monnier
0 siblings, 2 replies; 8+ messages in thread
From: Michael Heerdegen @ 2013-01-12 17:58 UTC (permalink / raw)
To: 13422
Hi,
I want to request to add something like this to subr.el or similar:
(defmacro-safe discard (&rest args)
"Do nothing, do not even eval ARGS, and return nil."
nil)
I.e., a counterpart of `ignore', as a macro.
What at first might seem a silly idea is indeed useful: I use it as a
possibility to uncomment code. Compared with normal uncommenting (M-;),
it has several advantages:
1. You can search for occurrences of `discard' to find such uncommented
code. Searching for "^;" would also give you text comments.
2. Paren matching, moving by sexps and such things, still work
normally.
3. The code inside the `discard' is still font-locked.
4. It is easy to copy and paste parts of discarded code. Inside real
comments, you always copy the commenting characters (;) along with the
code and have to remove it manually, which is annoying.
Just an idea. But it's IMHO useful for the end user, as a mean of
editing the Emacs init file. Of course, it would be easy to define it
in the init file itself, but I doubt that many people would have the
idea to do so.
Thanks,
Michael.
In GNU Emacs 24.2.91.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
of 2012-12-30 on drachen
Bzr revision: rgm@gnu.org-20121230122326-m6gw29pkwjgwqf9d
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
System Description: Debian GNU/Linux testing (wheezy)
Configured using:
`configure '--prefix=/usr/local/built/''
Important settings:
value of $LC_ALL: de_DE.utf8
value of $LC_TIME: C
value of $LANG: de_DE.utf8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil
2013-01-12 17:58 bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil Michael Heerdegen
@ 2013-01-12 20:19 ` Andreas Schwab
2013-01-12 21:50 ` Michael Heerdegen
2013-01-13 0:34 ` Stefan Monnier
1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2013-01-12 20:19 UTC (permalink / raw)
To: michael_heerdegen; +Cc: 13422
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Just an idea. But it's IMHO useful for the end user, as a mean of
> editing the Emacs init file.
(quote ...) does nearly the same.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil
2013-01-12 20:19 ` Andreas Schwab
@ 2013-01-12 21:50 ` Michael Heerdegen
2013-01-12 23:15 ` Andreas Schwab
0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2013-01-12 21:50 UTC (permalink / raw)
To: 13422
Andreas Schwab <schwab@linux-m68k.org> writes:
> (quote ...) does nearly the same.
Right. But it accepts only one argument, else you get compiler errors.
It is useful to be able to group several forms in one top level
`discard'. This way you have one sexp, can copy or uncomment it as a
whole, or jump to the beginning/end of it easily etc.
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil
2013-01-12 21:50 ` Michael Heerdegen
@ 2013-01-12 23:15 ` Andreas Schwab
2013-01-12 23:41 ` Michael Heerdegen
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2013-01-12 23:15 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 13422
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> (quote ...) does nearly the same.
>
> Right. But it accepts only one argument, else you get compiler errors.
Just put a pair of parens around them.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil
2013-01-12 23:15 ` Andreas Schwab
@ 2013-01-12 23:41 ` Michael Heerdegen
2013-01-12 23:58 ` Andreas Schwab
0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2013-01-12 23:41 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 13422
Andreas Schwab <schwab@linux-m68k.org> writes:
> >> (quote ...) does nearly the same.
> >
> > Right. But it accepts only one argument, else you get compiler errors.
>
> Just put a pair of parens around them.
Right again, nice.
OTOH, do you think that most users really will have this idea?
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil
2013-01-12 23:41 ` Michael Heerdegen
@ 2013-01-12 23:58 ` Andreas Schwab
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 2013-01-12 23:58 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 13422
Michael Heerdegen <michael_heerdegen@web.de> writes:
> OTOH, do you think that most users really will have this idea?
Put it in the manual, and it will be just as discoverable as your macro.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil
2013-01-12 17:58 bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil Michael Heerdegen
2013-01-12 20:19 ` Andreas Schwab
@ 2013-01-13 0:34 ` Stefan Monnier
2013-01-13 2:36 ` Michael Heerdegen
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2013-01-13 0:34 UTC (permalink / raw)
To: michael_heerdegen; +Cc: 13422
> it has several advantages:
Of course, it also has its down sides:
- returns nil, so (if foo (discard bar) then) runs the `then' in the
`else' branch.
- only works at those syntactic places where an expression is expected
(e.g. (let ((a 1) (discard exp1 exp2) (b 2)) blabla) doesn't work.
In any case, I think the current comments are good enough, and save the
programmer from having to choose which kind of comment to use.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil
2013-01-13 0:34 ` Stefan Monnier
@ 2013-01-13 2:36 ` Michael Heerdegen
0 siblings, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2013-01-13 2:36 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 13422
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Of course, it also has its down sides:
>
> - returns nil, so (if foo (discard bar) then) runs the `then' in the
> `else' branch.
>
> - only works at those syntactic places where an expression is expected
> (e.g. (let ((a 1) (discard exp1 exp2) (b 2)) blabla) doesn't work.
Indeed, you must keep this in mind. It might be confusing.
> In any case, I think the current comments are good enough, and save the
> programmer from having to choose which kind of comment to use.
Ok, so please close.
Thanks,
Michael.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-01-13 2:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-12 17:58 bug#13422: 24.2.91; Feature request: Add a macro always expanding to nil Michael Heerdegen
2013-01-12 20:19 ` Andreas Schwab
2013-01-12 21:50 ` Michael Heerdegen
2013-01-12 23:15 ` Andreas Schwab
2013-01-12 23:41 ` Michael Heerdegen
2013-01-12 23:58 ` Andreas Schwab
2013-01-13 0:34 ` Stefan Monnier
2013-01-13 2:36 ` Michael Heerdegen
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.