Is the following sort of shortcut macro possible to implement?
(defmacro region-end-beg ()
"Replacement for '(region-end) (region-begin)' in source code"
(...))
So that
(buffer-substring (region-end-beg))
(setq region-length (- (region-end-beg))
Can be used as a shortcut for
(buffer-substring (region-end) (region-beginning))
(setq region-length (- (region-end) (region-beginning))
This example is semi-contrived. What I'm interested in is there is a general technique to make this kind of macro in lisp (particularly elisp).
(with-region-end-beg ...)
that would replaces all occurences of(region-beg-end)
in the code indicated by...
with(region-end) (region-beginning)
. – Omar Nov 23 '19 at 17:21