Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

The tag has no usage guidance.

0
votes
2answers
45 views

Disabling a minor mode in a specific buffer

Running spacemacs 0.200.13 on emacs 25.2.2 on Kubuntu 18.04. I have globally enabled golden-ratio-mode (a minor mode). But I would like to disable it in a particular buffer, *Org Agenda* to be ...
0
votes
1answer
25 views

Cursor position variable

Here's my function: (defun scroller-down () "Scrolling down conditional for buffer and minibuffer." (interactive) (if (active-minibuffer-window) (ivy-scroll-down-command) (scroll-down-...
0
votes
0answers
26 views

Mode dependant key binding

I wrote an elisp function which I would like to bind to the key "C" but only in dired-mode; otherwise it should be the capital letter C. However I am not very familiar with elisp and I did not manage ...
7
votes
3answers
227 views

Using case to compare with a variable

I expected the outcome of the following small program: (progn (setq x 1) (case x (x 'Yes) (t 'No))) to be Yes, given that case compares things with eql, and surely x is eql to itself. ...
0
votes
2answers
826 views

In Spacemacs, how to customize keybindings that are condition on language file?

Here is what I would like to do. I would like to customize key bindings that point to a different command depending on the file type on which the user is operating. For instance, if one presses f5 in ...
1
vote
0answers
51 views

Constrain Eclim to java files

I am using eclim and I am loving it! But I had to disable eclimd-autostart because it keep trying to fire up eclimd when I pop a .js buffer. Autostarting of eclimd is disabled, please start eclimd ...
6
votes
2answers
1k views

`case` doesn't switch correctly with strings

I have the following code which doesn't work: (eval-when-compile (require 'cl)) (setq mymachine (system-name)) (case mymachine ("HP" (setq package-user-dir (concat user-emacs-directory "packages/...
5
votes
2answers
112 views

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 ...
7
votes
2answers
77 views

Is there a way to only accept certain arguments to a function?

I want to write a function where the only two valid values for the input argument are "dag" or "rulegraph". Is there a way to specify that only these two arguments are accepted this in the elisp ...
4
votes
2answers
182 views

Elisp code execution order?

I cannot understand the behavior of this simple code: (defun foo (str bool) (interactive (list (read-string "Some text: ") (y-or-n-p "Yes or no? "))) (message "%s is first" str) (...
1
vote
1answer
91 views

How execute multiple lists in a true statement?

For this simple question, I never found any answer. Let assume I have the following: (if (true) (foo1) ;; When true (bar) ;; When false) So I would like to combine foo1 and foo2 (if (true) ...
6
votes
7answers
630 views

`cond` with less redundancy

Is there a better way to write the below code with less redundancy? (cond ((firstFunction str1) (secondFunction str1)) ((firstFunction str2) (secondFunction str2)) ((firstFunction str3) (...
12
votes
2answers
979 views

“and” vs “when” for conditionals

This is a follow-up on the comments on this answer. The following bits of code seem to be equivalent: (and a b) (when a b) Of course and lets you put more conditions: (and a b c d) means (when (and ...