help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Help setting nadvice for indent-region


From: Michael Heerdegen
Subject: Re: Help setting nadvice for indent-region
Date: Fri, 12 Feb 2016 15:21:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.90 (gnu/linux)

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Kaushal Modi <kaushal.modi@gmail.com> writes:
>
> > OK, so this is what I have now.
> >
> > (defun modi/advice-region-or-whole (&rest args)
> >   "Advice function that sets the region boundaries to that of the whole
> > buffer
> > if no region is selected."
> >   (interactive (if (use-region-p)
> >                    (list (region-beginning) (region-end))
> >                  (list (point-min) (point-max))))
> >   ;; (message "Args: %S R: %S I: %S"
> >   ;;          args (use-region-p) (called-interactively-p 'interactive))
> >   (when (and (eq (first args) (point-min))
> >              (eq (second args) (point-max)))
> >     (message "Executing %s on the whole buffer."
> >              (propertize (symbol-name this-command)
> >                          'face 'font-lock-function-name-face)))
> >   nil)
>

Oh, and `first', `second' are defined in the old cl.el.  It's
recommended to use `cl-lib' now, and thus `cl-first', `cl-second'.
Or simply `car' and `cadr'.

Michael.




reply via email to

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