Background
I see the question Best way to disable code:
I think something like the following would be nice:
(off (global-set-key "\C-x" 'do-stuff) (defun do-stuff () ...))
I understand I can define
off
myself, but isn’t there a standard way to do this?
and the corresponding answer by gigiair:
(defun off (&rest args) "Do nothing and return nil." nil)
But I think this solution has 2 disadvantages considering that every function will evaluate its arguments and return something, for example (which is about "return something"):
(custom-set-variables
(off '(display-time-mode t)) ; ==> (), which is non-well-formed
'(blink-cursor-mode nil))
Using the off
function will lead to a non-well-formed s-expression (which is not expected by custom-set-variables
).
Q
The key may be to define something that returns nothing, like:
(defmacro erase-code (&rest pieces-of-code)
...)
which will make the last example expand to:
(custom-set-variables
'(blink-cursor-mode nil))
In other words, it leaves nothing.
Maybe the ultimate solution is not about macro, i don't know.
Essentially, I am asking: Is there anything that can return nothing or leave nothing in place in Common Lisp or Emacs Lisp?