emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] master b88e7c8: Make transpose-regions interactive (Bu


From: Karl Fogel
Subject: Re: [Emacs-diffs] master b88e7c8: Make transpose-regions interactive (Bug#30343)
Date: Wed, 28 Mar 2018 23:53:53 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Juri Linkov <address@hidden> writes:
>Why not use a compromise and move only the interactive spec to simple.el:
>
>(put 'transpose-regions
>     'interactive-form
>     '(if (< (length mark-ring) 2)
>         (error "Other region must be marked before transposing two regions")
>       (let* ((num (if current-prefix-arg
>                       (prefix-numeric-value current-prefix-arg)
>                     0))
>              (ring-length (length mark-ring))
>              (eltnum (mod num ring-length))
>              (eltnum2 (mod (1+ num) ring-length)))
>         (list (point) (mark) (elt mark-ring eltnum) (elt mark-ring 
> eltnum2)))))

Personally, I think I'd prefer to have the interactive form together with the 
rest of the function definition, even if that's in C.

However, the method you suggest is a nice way of overriding the interactive 
spec of a C-defined Lisp function, for example for when one wants to experiment 
with ways to improve the interactive behavior.

What would you think of mentioning this trick in doc/lispref/internals.texi, in 
the text for "@item interactive"?

Best regards,
-Karl



reply via email to

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