Skip to main content

Questions tagged [buffer-local]

Filter by
Sorted by
Tagged with
0 votes
1 answer
129 views

I love using cape in text mode, but I cannot figure out how to stop it from activating in programming modes. Is it possible to either only enable it in certain modes or to disable it in specific modes?...
J. Mini's user avatar
  • 265
0 votes
2 answers
131 views

I'm trying to define a buffer-local variable inside a function using setq-local in a function here is the function definition: (defun set-buffer-local-variable () (with-current-buffer (get-buffer-...
ntriisii's user avatar
1 vote
1 answer
150 views

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 ...
Lorenzo Marcantonio's user avatar
4 votes
1 answer
470 views

I have a project where I want to disable format-all-mode for all my python files. I can do this manually by running M-x format-all-mode every time I open up a python file for that project. I tried ...
modulitos's user avatar
  • 2,632
2 votes
1 answer
101 views

Two examples (both are in the *scratch* buffer and under lexical scoping rule): _ (setq xx :default) (let ((xx :let)) (with-current-buffer (get-buffer-create "tmp") (make-local-...
shynur's user avatar
  • 6,200
3 votes
1 answer
243 views

12.11.2 Creating and Deleting Buffer-Local Bindings: Making a variable buffer-local within a let-binding for that variable does not work reliably, unless the buffer in which you do this is not ...
shynur's user avatar
  • 6,200
1 vote
0 answers
852 views

In Emacs 29.0.60, (setf (buffer-local-value 'foo (current-buffer)) 42) produces the warning above. What's the recommended way of changing a buffer-local variable in another buffer? (the above is an ...
Tamas Papp's user avatar
3 votes
3 answers
149 views

So I'm writing some custom functions to help me editing some guitar chords using LaTeX's songs package. I find convenient to rebind isearch-exit, so that when I press RET, the cursor is left at the ...
Alessandro Bertulli's user avatar
0 votes
0 answers
72 views

I want to write a function that gets the working value of a buffer local variable. Customarily if a buffer local variables is not defined, it might have a default value set up.
Dilna's user avatar
  • 1,473
1 vote
2 answers
1k views

To set functions on a local buffer I use the following technique: * Local Variables :noexport: # Local Variables: # eval: (view-mode 1) # eval: (visual-line-mode 0) ... # End: However, when I try to ...
crocefisso's user avatar
  • 1,549
0 votes
1 answer
154 views

Have found the tab-always-indent setting and wonder the appropriateness of (setq tab-always-indent 'complete) versus (setq-local tab-always-indent 'complete)
Dilna's user avatar
  • 1,473
1 vote
0 answers
64 views

I'm running a specific console application in a term window (char/raw mode). This application has no need for C-h, C-x, and M-x, so they should just do what they always do in Emacs. However, I don't ...
fred's user avatar
  • 21
1 vote
1 answer
60 views

For Ediff's wide display feature I like to use my own ediff-make-wide-display function. Ediff has a variable for this: ediff-make-wide-display-function. However when I write: (defun my-ediff-make-wide-...
halloleo's user avatar
  • 1,445
0 votes
1 answer
277 views

I want to give an arbitrary command some buffer-local behavior without advising it. (I can do it by advising, but I want to also be able to do it without advising.) E.g., just looking at some ...
Drew's user avatar
  • 80.9k
2 votes
1 answer
63 views

I can use setq-default to set a symbol's default value, as follows: (with-temp-buffer (make-local-variable 'bar) (setq-default bar "xyz") (symbol-value 'bar)) When I first executed ...
Searene's user avatar
  • 589
1 vote
2 answers
669 views

I want to do something VERY simple. I want to create a minor mode, which when enabled sets a buffer-local variable (say left-margin-width, for instance) with a specific value. I can do this: (define-...
sixter's user avatar
  • 113
1 vote
1 answer
458 views

It works when using setq-default in place of setq or when customizing through C-h v. C-h v reports that it is set in 'C source code'. I was thinking it might be affected by my c-default-style, but my ...
mcp's user avatar
  • 626
0 votes
0 answers
82 views

is there a way to have the global minor mode show-paren-mode functionality as a buffer-local minor mode? I love its behavior but only for Lisp. Searching for a package I can see a number of close ...
q.undertow's user avatar
2 votes
1 answer
415 views

Does Emacs have a way to set buffer-local properties on symbols? It's well-known that there are buffer-local variables. But a property belongs to a symbol, not to a variable. Hence, if I have ...
Lassi's user avatar
  • 397
0 votes
2 answers
121 views

I have a package with the variable my-package--my-var that needs to be buffer-local when my-package-buffer-only is t but global if my-package-buffer-only is nil. This is what I have so far: (...
tastytea's user avatar
  • 105
1 vote
1 answer
558 views

I am using org-mode TODO tracking change (in-buffer settings) and I'm having some issues. All the info is taken from the official docs (https://orgmode.org/manual/Tracking-TODO-state-changes.html) I ...
Sergiu Elmi's user avatar
1 vote
3 answers
445 views

I've been trying to create a command that, when run, calls another function (my-function) which reads from the minibuffer and does some processing on the input. I want the command history for this ...
Federico's user avatar
  • 257
0 votes
1 answer
366 views

I want to override the function helm-swoop-pre-input-optimize in man mode using its hook, but not anywhere else. Is there something similar to make-local-variable for functions?
HappyFace's user avatar
  • 930
1 vote
1 answer
451 views

I called add-hook multiple times because I had a few typos in the hook function, and now there are a bunch of broken copies of it in the hook. I want to do (setq after-save-hook nil), but after doing ...
user1122107's user avatar
1 vote
3 answers
3k views

In my Emacs config, I have set Firefox to be the browser to open URLs with, (setq browse-url-browser-function 'browse-url-firefox) Now, I have one org-mode file, in which I would like to open URLs ...
andreas-h's user avatar
  • 1,589
1 vote
0 answers
188 views

Is there a way to make buffer-local overrides to exec-path (whose value is normally initialized with the PATH environment variable)? I tried (make-variable-buffer-local 'exec-path) and local ...
Lassi's user avatar
  • 397
1 vote
1 answer
474 views

I have made buffer local changes to `process-environment' using the technique described in How can I get buffer-local environment variables via .dir-locals. I then call shell from that buffer. If I ...
Benilda Key's user avatar
2 votes
2 answers
3k views

I'd like to register an after-save-hook that is only active in certain buffers that I specify. For example, assume there are 3 functions currently registered in my after-save-hook: hook-01, hook-02, ...
HippoMan's user avatar
  • 656
4 votes
1 answer
1k views

I am trying to create a buffer local advice to run some code when a minor mode is disabled. I looked through the documentation for add-function and saw this If PLACE is a symbol, its `default-value' ...
Prgrm.celeritas's user avatar
6 votes
1 answer
2k views

I'm using emacs for many different projects. For some of them, I need, for example, different entries in $PATH, or different $MAKEFLAGS, whatever, you name it... I thought this would be possible ...
Markus's user avatar
  • 481
5 votes
2 answers
1k views

I'm in buffer A and I want to set a buffer-local variable in buffer B. I'm currently doing: (with-current-buffer B (setq-local some-var 'some-val)) but is there a way to do this without changing ...
ivan's user avatar
  • 2,008
7 votes
2 answers
1k views

Say I define a buffer-local variable foo, and its default value is "a": (defvar foo "a") (make-variable-buffer-local 'foo) (default-value 'foo) ;; => "a" Immediately after this I run the following ...
cutejumper's user avatar
0 votes
1 answer
232 views

Subtract a buffer's (the file's) size from a variable before killing it. Emacs 26. (defvar cumulative-open-bytes '0 ) (defun buffer-settings-calc-bytes () (interactive) (let ((current-open-file-...
Austin's user avatar
  • 3
3 votes
1 answer
822 views

I am developing a feature to adapt a mode-line to the width of the window. I have developped it so far using buffer-local variables to store the state of the mode-line, however, when I open the same ...
deb0ch's user avatar
  • 213
2 votes
0 answers
38 views

In a compilation buffer, when I set buffer local variable like so: (setq-local foo 'bar) Doing a (recompile) will unset this variable. Is there a way to keep the buffer local value permanent through ...
rgrinberg's user avatar
  • 143
2 votes
1 answer
256 views

text-scale-mode uses a buffer-local face-remapping-alist to scale the buffer's text, adding values like (:height 1.2). It stores a "cookie" with the scaling it has applied in another local variable, ...
ivan's user avatar
  • 2,008
-1 votes
1 answer
473 views

I'm looking for a way to set a variable that isn't buffer local in such a way that it will act like one. It's possible to do it with file local variables, but I haven't found a way to set a variable ...
user avatar
0 votes
1 answer
282 views

In my init file I have this: (add-hook 'prog-mode-hook (lambda () (linum-mode 1))) So it shows line numbers only for programming modes. I tried to do the same with hl-line-mode, but it does not work: ...
Juan Herrero Diaz's user avatar
5 votes
2 answers
3k views

Seems like most major modes clear all local variables before initializing. It also seems like many major modes read variables while initializing to customize their behavior. If I want to set a file ...
sfridman's user avatar
  • 151
1 vote
2 answers
697 views

In realgud I have a text button that needs access to a dynamically-bound buffer-local variable. The situation occurs like this. Inside one buffer that has the buffer local variable, there is a ...
rocky's user avatar
  • 928
1 vote
0 answers
555 views

I have the following line turning hl-line-mode on globally in my init file: (global-hl-line-mode) Most of the time, that's how I like it. But sometimes I want to turn it off. I'd hoped that I could ...
ivan's user avatar
  • 2,008
23 votes
1 answer
8k views

I'm not quite clear on all the variations of buffer-local variables, even after reading all the doc and a bunch of postings here on SX. Here's a summary of my understandings: (defvar foo ..) ...
Kevin's user avatar
  • 1,348
15 votes
1 answer
2k views

The variable safe-local-variable-values can store name/value pairs that are safe as file-local or directory-local. However sometimes I want to say any value is valid for a given variable. The manual ...
Brendan's user avatar
  • 303
1 vote
1 answer
134 views

Does Emacs have some notion of associating minor modes with windows rather than setting them as "global" or "buffer-local"? For example, in a certain window layout I may wish to have a minor mode ...
ebpa's user avatar
  • 7,661
2 votes
1 answer
229 views

After having a problem with debugging a package I write, I finally tracked down the problem to the following: auto-revert-mode is making kill-buffer-hook buffer-local (which is fine by me). The ...
François Févotte's user avatar
3 votes
1 answer
3k views

I want to use .dir-locals.el to append to the before-save-hook in a project for c++ files. Currently I'm using: (add-hook 'c++-mode-hook (lambda () (add-hook 'before-save-hook '...
kain88's user avatar
  • 845
1 vote
1 answer
112 views

I'm learning to program with buffer local variables. The emacs documentation describes buffer local variables as: A buffer-local variable has a buffer-local binding associated with a particular ...
djechlin's user avatar
  • 933
6 votes
1 answer
3k views

I see that I can do something like this: (defun limit-warnings () (set (make-local-variable 'warning-minimum-level) 'fatal)) (add-hook 'minibuffer-setup-hook 'disable-warnings) (Sorry for syntax ...
bright-star's user avatar
4 votes
2 answers
892 views

I'm trying to get rid of tabs, following this guide: (setq-default indent-tabs-mode nil) So: why setq-default and not setq? I know I would need to use setq-default for a buffer-local variable, but I ...
djechlin's user avatar
  • 933
12 votes
2 answers
2k views

I want to be able to save my buffer local evil markers (m to mark a location and then ' or ` to jump to it) across emacs sessions/instances. I'm not really sure how to do this. I tried installing/...
noctuid's user avatar
  • 439