GNU bug report logs - #13422
24.2.91; Feature request: Add a macro always expanding to nil

Previous Next

Package: emacs;

Reported by: michael_heerdegen <at> web.de

Date: Sat, 12 Jan 2013 17:58:02 UTC

Severity: wishlist

Tags: wontfix

Found in version 24.2.91

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13422 in the body.
You can then email your comments to 13422 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13422; Package emacs. (Sat, 12 Jan 2013 17:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to michael_heerdegen <at> web.de:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 12 Jan 2013 17:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2.91; Feature request: Add a macro always expanding to nil
Date: Sat, 12 Jan 2013 18:58:00 +0100
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 <at> 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13422; Package emacs. (Sat, 12 Jan 2013 20:20:02 GMT) Full text and rfc822 format available.

Message #8 received at 13422 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: michael_heerdegen <at> web.de
Cc: 13422 <at> debbugs.gnu.org
Subject: Re: bug#13422: 24.2.91;
	Feature request: Add a macro always expanding to nil
Date: Sat, 12 Jan 2013 21:19:17 +0100
Michael Heerdegen <michael_heerdegen <at> 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 <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13422; Package emacs. (Sat, 12 Jan 2013 23:08:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#13422: 24.2.91;
	Feature request: Add a macro always expanding to nil
Date: Sat, 12 Jan 2013 22:50:37 +0100
Andreas Schwab <schwab <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13422; Package emacs. (Sat, 12 Jan 2013 23:16:02 GMT) Full text and rfc822 format available.

Message #14 received at 13422 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 13422 <at> debbugs.gnu.org
Subject: Re: bug#13422: 24.2.91;
	Feature request: Add a macro always expanding to nil
Date: Sun, 13 Jan 2013 00:15:08 +0100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Andreas Schwab <schwab <at> 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 <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13422; Package emacs. (Sat, 12 Jan 2013 23:42:02 GMT) Full text and rfc822 format available.

Message #17 received at 13422 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 13422 <at> debbugs.gnu.org
Subject: Re: bug#13422: 24.2.91;
	Feature request: Add a macro always expanding to nil
Date: Sun, 13 Jan 2013 00:41:45 +0100
Andreas Schwab <schwab <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13422; Package emacs. (Sat, 12 Jan 2013 23:59:02 GMT) Full text and rfc822 format available.

Message #20 received at 13422 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 13422 <at> debbugs.gnu.org
Subject: Re: bug#13422: 24.2.91;
	Feature request: Add a macro always expanding to nil
Date: Sun, 13 Jan 2013 00:58:36 +0100
Michael Heerdegen <michael_heerdegen <at> 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 <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13422; Package emacs. (Sun, 13 Jan 2013 00:36:01 GMT) Full text and rfc822 format available.

Message #23 received at 13422 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: michael_heerdegen <at> web.de
Cc: 13422 <at> debbugs.gnu.org
Subject: Re: bug#13422: 24.2.91;
	Feature request: Add a macro always expanding to nil
Date: Sat, 12 Jan 2013 19:34:54 -0500
> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13422; Package emacs. (Sun, 13 Jan 2013 02:37:01 GMT) Full text and rfc822 format available.

Message #26 received at 13422 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13422 <at> debbugs.gnu.org
Subject: Re: bug#13422: 24.2.91;
	Feature request: Add a macro always expanding to nil
Date: Sun, 13 Jan 2013 03:36:57 +0100
Stefan Monnier <monnier <at> 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.




Added tag(s) wontfix. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 13 Jan 2013 19:11:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 13422 <at> debbugs.gnu.org and michael_heerdegen <at> web.de Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 13 Jan 2013 19:11:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 11 Feb 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 215 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.