Skip to main content
6 votes
Accepted

Can you intercept a function and return your own value using advice?

Of course you can. You can do it with: (advice-add 'read-from-minibuffer :around #'return-my-name) (defun return-my-name (orig-fun &rest args) (let ((orig-val (apply orig-fun args))) <...
Stefan's user avatar
  • 26.5k
3 votes

How to copy a function?

Use funcall or apply: (setq wrapped-copy (symbol-function 'emacs-version)) (fset 'fn (lambda () (funcall wrapped-copy))) (fn) "GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24....
NickD's user avatar
  • 30.8k
3 votes

How can I create an alias for a function name?

Yes. You can have any number of aliases for the same function. To do that, use defalias (or fset, but defalias is generally recommended). Example: define mop as an alias for means-of-production. (...
Drew's user avatar
  • 78k
2 votes
Accepted

Is there any way of making eshell aliases using bash and zsh aliases syntax?

If you go over to EshellAlias on EmacsWiki, there are many solutions to this problem. The one by Edgar Vincent that's currently at the very bottom of the page is the most concise and elegant solution ...
g-gundam's user avatar
  • 1,281
2 votes
Accepted

oddp vs cl-oddp in elisp script

If you load library cl.el then C-h f oddp tells you this: oddp is an alias for cl-oddp in cl.el. (oddp INTEGER) Return t if INTEGER is odd. This function does not change global state, including the ...
Drew's user avatar
  • 78k
2 votes

two versions of emacs on mac osx - where are they

It is one question per customer / thread ... As to the first question, the great thing about Emacs from https://emacsformacosx.com/ is that it is a self-contained installation. The executable is ...
lawlist's user avatar
  • 19.2k
1 vote
Accepted

The Emacs eshell alias of CMake doesn't recognize path correctly?

You need to include the arguments in the Eshell alias as $1, $2, ... or as full list of provided arguments $*. See the documentation of Eshell aliases. In your special case you could use: alias cmake '...
Tobias's user avatar
  • 33.3k
1 vote

How to create a short name for tramp multihop path?

Read the Tramp Manual, chapter Frequently Asked Questions (https://www.gnu.org/software/tramp/#Frequently-Asked-Questions). It explains in length several approaches to shorten remote file names. These ...
Michael Albinus's user avatar
1 vote

defalias derived mode to parent mode

Here's how you can do what you intended, while avoiding the inf-loop: (defalias 'old-conf-mode (symbol-function 'conf-mode)) (define-derived-mode conf-mode old-conf-mode ...) Note that this is still ...
Stefan's user avatar
  • 26.5k
1 vote
Accepted

defalias derived mode to parent mode

The nature of a derived mode is that its parent is called before the body of the child mode is evaluated1. Therefore if the child becomes its own parent (or grandparent, etc...), that causes infinite ...
phils's user avatar
  • 51.6k
1 vote

How replace auto-complete-mode with company-mode in all major mode using it?

Uninstall emacs-auto-complete using yum or dnf and install company using the emacs package manager. Turn company on with (global-company-mode) ur use *mode-hooks to turn it on for specific modes.
Ista's user avatar
  • 1,188

Only top scored, non community-wiki answers of a minimum length are eligible