Questions tagged [monkey-patching]
5 questions
5
votes
2 answers
Shallowly override functions within a target function
I'm exploring options for monkey-patching and I'm wondering if the following is within reason.
I would like to override a particular function within some target function so that calls within the target function are overridden, but functions called…

ebpa
- 7,319
- 26
- 53
3
votes
1 answer
How do I temporarily mock a function for testing?
I'd like to patch some elisp functions inside my unit tests. I've tried cl-labels and cl-flet, but neither achieve the result I want:
(defun return-number ()
1)
(defun calls-return-number ()
(return-number))
(defun patch-cl-labels ()
…

Wilfred Hughes
- 6,890
- 2
- 29
- 59
2
votes
1 answer
Workaround for "Invalid search bound (wrong side of point)" in CC Mode
Emacs 24.x and 25.x have a bug in CC Mode which can result in some operations failing with the error
Invalid search bound (wrong side of point)
For example, I can reproduce it with the following file a.c:
#if defined(FOO) || \
…

Gilles 'SO- stop being evil'
- 21,702
- 4
- 53
- 89
0
votes
2 answers
Any way to access a lexical let variable outside of the let?
I need to retrieve a local, lexical, runtime variable from a function, but I'm unable to modify the function to return it because it is from an external library. The variable I'm unable to reach is link-end.
(defun org-element-link-parser ()
(let…

sextrism
- 1
- 1
0
votes
2 answers
How do you do runtime code swapping?
Does elisp have the "runtime code swapping" feature?
mentioned in slide at 27:14
https://www.youtube.com/watch?v=3TlEqzptWr0&t=27m14s
Hot code loading is the art of replacing an engine from a running car without having to stop it.
Definition of…

american-ninja-warrior
- 3,773
- 2
- 21
- 40