Questions tagged [defun]
The defun tag has no summary.
47 questions
3 votes
1 answer
182 views
Advice vs replacing function definition
Say, an external package defines these functions: (defun my/inner (x) (1+ x)) (defun my/outer () (my/inner 7)) We want to create a function that wraps my/outer, replacing my/inner with the ...
0 votes
3 answers
90 views
Declare function argument as being a function, not a variable
Consider the following code (defun somefunc (text) (message "hello, somefunc called with %s" text) ) (defun func-caller (func) (func "some string") ) (func-caller 'somefunc) ...
0 votes
0 answers
53 views
Yank to char using avy including the selected character
I want to be able to yank the text to char including the character using avy. For this I wrote the following command: (defun my/yank-to-char-avy () "Delete region from point to a character.&...
0 votes
2 answers
158 views
Defmacro: Create functions from a list o functions
I have this code: (defmacro with-ignore-mouse-events (&rest body) "Macro to ignore mouse events before evaluating BODY." `(progn (when (input-pending-p) (let ((event (...
1 vote
2 answers
124 views
How to view defuns in file order?
I think I'm missing something about imenu. I'm interested in viewing the top-level definitions in file order. When I run imenu I get a prompt in the minibuffer that says Index item:. If I then hit TAB ...
1 vote
1 answer
148 views
Is there a reason for having beginning-of-defun-function/end-of-defun-function global?
I was working on a mode, setq'ed them with my functions and... emacs broke (really) For some reason these variable are global. I made them buffer-local, but is there a good reason for having them ...
3 votes
2 answers
266 views
the Name of Function defined in C
I tried to use GDB to debug Emacs. More specifically, I want to observe the behavior of a function written in C. vertical-motion is a built-in function in ‘C source code’. However, the name of a C ...
2 votes
2 answers
188 views
Why can't I defun "nil" as a function name
I know that nil is a constant so its value cell cannot be changed, but why its function cell cannot be set as well? ELISP> (defun t ()) t ELISP> (defun nil ()) *** Eval error *** Cannot define ...