From: Kaushal Modi <kaushal.modi@gmail.com>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>,
embe8573@student.uu.se
Subject: Re: Help setting nadvice for indent-region
Date: Sat, 06 Feb 2016 03:31:35 +0000 [thread overview]
Message-ID: <CAFyQvY2pa6ANob_DnTjur5D9-TmOg-m53id1RCHW0SuR=WimjQ@mail.gmail.com> (raw)
In-Reply-To: <878u2yof32.fsf@debian.uxu>
On Fri, Feb 5, 2016 at 7:30 PM Emanuel Berg <embe8573@student.uu.se> wrote:
> Advices are always tricky. Instead I'd do something
> like this:
>
> (defun indent-region-dwim ()
> (interactive)
> (if mark-active
> (indent-region (mark) (point))
> (indent-region (point-min) (point-max) )))
>
> And then rebind shortcuts, or use this method:
>
> (define-key (current-global-map) [remap w3m-quit]
> #'no-confirm-w3m-quit)
>
Thanks Emanuel.
What you suggested was my plan B and that's what I have executed now. I
have taken your idea to create a generic "region or whole" function
generator.
https://github.com/kaushalmodi/.emacs.d/blob/b013406a864de46f0fb479e339b04945f8f01351/setup-files/setup-editing.el#L686-L716
To all, I am still curious to know if it is possible to achieve the same
using nadvice. If not, then is it an advice limitation that we cannot
override the nature of interactive function arguments? In this case, looks
like we cannot call indent-region with nil args even though we have an
advice designed to set those args automatically to non-nil values.
next prev parent reply other threads:[~2016-02-06 3:31 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-05 23:49 Help setting nadvice for indent-region Kaushal Modi
2016-02-05 23:58 ` Kaushal Modi
2016-02-06 0:00 ` Kaushal Modi
2016-02-06 0:30 ` Emanuel Berg
2016-02-06 3:31 ` Kaushal Modi [this message]
2016-02-06 10:43 ` Michael Heerdegen
2016-02-07 3:12 ` Kaushal Modi
2016-02-07 17:46 ` Kaushal Modi
2016-02-07 18:51 ` John Mastro
2016-02-08 0:03 ` Emanuel Berg
2016-02-08 4:22 ` Kaushal Modi
2016-02-08 17:05 ` Eli Zaretskii
2016-02-08 17:27 ` Kaushal Modi
2016-02-09 3:07 ` Emanuel Berg
2016-02-08 20:03 ` John Mastro
2016-02-08 23:13 ` Emanuel Berg
2016-02-11 14:02 ` Stefan Monnier
2016-02-11 17:36 ` Kaushal Modi
2016-02-11 18:10 ` Michael Heerdegen
2016-02-11 18:47 ` Kaushal Modi
2016-02-11 18:56 ` Kaushal Modi
2016-02-11 19:14 ` Michael Heerdegen
2016-02-11 20:15 ` Kaushal Modi
2016-02-11 20:38 ` Kaushal Modi
2016-02-12 14:09 ` Michael Heerdegen
2016-02-12 14:21 ` Michael Heerdegen
2016-02-12 16:02 ` Kaushal Modi
2016-02-12 19:04 ` Michael Heerdegen
2016-02-12 13:57 ` Michael Heerdegen
2016-02-11 19:03 ` Michael Heerdegen
2016-02-07 23:48 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFyQvY2pa6ANob_DnTjur5D9-TmOg-m53id1RCHW0SuR=WimjQ@mail.gmail.com' \
--to=kaushal.modi@gmail.com \
--cc=embe8573@student.uu.se \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).