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

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

mixing argument types (was: Re: replace-regexp from A to B?)


From: Emanuel Berg
Subject: mixing argument types (was: Re: replace-regexp from A to B?)
Date: Sun, 26 Aug 2018 21:42:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

>> Thanks, Yuri and Emanuel... I've seen that
>> a single MusiXTeX piece can be considered as
>> a tex paragraph, because no blank line
>> should be inserted into it... So I can
>> perform my replace-regexp with the `M-h'
>> prefix so applying it only to the current
>> paragraph/piece...
>
> So you can do this already with
> `replace-regexp'! Writing my previous answer,
> I had an itchy feeling it was already there
> somewhere... But who would have thought to
> look at replace-regexp of all places? Err,
> good that you found it anyway :)
>
> Technically speaking tho, and I think you
> already know this, `M-h' isn't a prefix to
> the next function but just a command to set
> the region. Once there, replace-regexp acts
> on it, but it doesn't matter in what manner
> you set it prior to that.
>
> Not to say there's anything wrong with using
> M-h, of course.

This brings me to something I have thought
about a couple of times, namely what is the
right way to write the interactive
specification of a function that reads
argument(s) from the minibuffer, AND, if
available, act on the region as well?

(defun do-a-on-b (a b &optional start stop)
  (interactive
    ;; check (use-region-p)
    (list 
      ;; ask for a
      ;; ask for b
      start
      stop)
      ;; ...
      )
    ;; ...
  ;; do it
  )

?

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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