Skip to main content

Questions tagged [narrowing]

Questions related to narrowing (restricting) the editable area of a buffer.

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

Suppress scrolling

I'd like to fit stuff some to the current window and want suppress scrolling completely. So the last line displayed in the window should correspond to the last line of the buffer. And if the the point ...
dmw64's user avatar
  • 219
1 vote
0 answers
178 views

Programmatically use org-tags-view to search in current subtree

I am looking for a way to programmatically search for headings in the current subtree. More specifically, I have a vocabulary file, in which I store words I need to learn. Each word is a subtree in ...
Zelphir Kaltstahl's user avatar
0 votes
1 answer
26 views

Weird `(point-max)` in testing function in `magic-mode-alist`

Why does the below function always print 4001 when opening a large file? (require 'cl-lib) (defun custom-test-p () (with-current-buffer (current-buffer) (print (point-max))) ; 4001 nil) (cl-...
Saddle Point's user avatar
1 vote
0 answers
61 views

Is there any way (built-in or not) to display a sub-tree as a top level tree when narrowed?

When I narrow to a subheading in emacs, I would love for it to be displayed as if it was the top level as opposed to it staying the level it actually is. For example consider this tree * Heading 1 ** ...
wychwitch's user avatar
0 votes
0 answers
69 views

org-mode Widen All of It

Whenever I open an org file in a specific way, it sort of opens it narrowed, not displaying all of its content. I've tried the widen function, but that only works after narrowing it;) What I do, is go ...
Jason Hunter's user avatar
3 votes
1 answer
98 views

Put “save-excursion” Outermost When Using Both “save-excursion” And “save-restriction”

I'm reading Emacs Lisp Intro by Robert J. Chassell. In 6.1 The ‘save-restriction’ Special Form when you use both ‘save-excursion’ and ‘save-restriction’, one right after the other, you should use ‘...
shynur's user avatar
  • 5,890
2 votes
1 answer
79 views

How to create buffer for custom source code region (e.g for each function)?

Objective : Frame some areas in a source code file, with custom pattern (e.g "# - Name of Region - #"), and then having the choice to type the name of region to directly open a buffer ...
Guest4314's user avatar
0 votes
2 answers
51 views

Emacs ruby-mode how to prevent narrowed buffer from widening when manual save is triggered

I just discovered narrowing in Emacs, and it's great to be able to focus on a single function or block of code. However, after I narrow with C-x n n, make some changes and then save manually with C-x ...
may's user avatar
  • 125
0 votes
2 answers
534 views

How to use org-tree-to-indirect-buffer and turn off org-indent-mode in the new indirect buffer, with a toggle to go back, all in a single key binding?

I like using org-mode as a distraction free text editor. I also like using org-indent-mode when navigating my entire file. I also like using org-tree-to-indirect-buffer to focus on a desired section ...
tiveriphysto's user avatar
1 vote
1 answer
34 views

How to widen all live buffers?

I'd like to apply e.g. widen to all active buffers, rather than the current one. How can I do this?
George's user avatar
  • 939
3 votes
1 answer
114 views

Why advice won't work if the function is called from another compiled function?

Let's consider a minimal example, I take org-narrow-to-subtree as a compiled function, under the hood it calls narrow-to-region, I add simple advice to it: (defun bark (START END) (message "Bark!&...
Daniel Vartanov's user avatar
1 vote
0 answers
74 views

widening/narrowing with org-goto

org-goto (as well as orgnav, helm-org-rifle) strictly respects narrowing. is there a way to have it disregard it, making it possible to jump to places in the file outside current narrowing? or is ...
martian's user avatar
  • 608
2 votes
1 answer
275 views

Any possibility to show multiple narrowed regions at the same time in a buffer?

As title self-explains, I would like to show multiple regions in different places. narrow-to-region could be a possible solution, but as documentation indicated, only one region from begin to end ...
Leu_Grady's user avatar
  • 2,502
3 votes
1 answer
160 views

Centering within comment blocks or ASCII art

I have C comments like this: /****************************************************************************** * Includes * ***********...
Vercingatorix's user avatar
0 votes
0 answers
79 views

Work in indirect-buffer faster than in original?

When I read the org-manual which are about 12,000 lines long, it's slow to edit such a large file. Then I invoke "narrow-to-substree" and read "2.Documents Structure" in a indirect-buffer. At this ...
Wizard's user avatar
  • 1,281
2 votes
0 answers
99 views

Dired-narrow view disappears after using dired-toggle-read-only

I use the package dired-narrow (which I have bound to C-x /) together with dired-toggle-read-only (C-x C-q). However, if I press C-c C-c to commit my changes after using dired-toggle-read-only this ...
Edman's user avatar
  • 1,229
1 vote
0 answers
84 views

OrgMode table text narrowing issue with links

I have an issue with my GNU Emacs 26.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.8) of 2019-04-30 in OrgMode. I have a table. One of its collumn is filled with internal links (inside ...
bvn13's user avatar
  • 11
2 votes
3 answers
501 views

How to display absolute line numbers of a full, widened buffer when narrowing to just part of it?

This question applies in the context of all line numbering implementations I've tried, including line-number, nlinum, and linum, so I have a feeling that the answer will have something to do with ...
eeowaa's user avatar
  • 372
1 vote
0 answers
32 views

Hide extra stars when narrowed to subtree

I have an outline with many levels of indentation. When I narrow to a particular subtree, I would like to hide the extra stars (and indentation) so that It looks like I am working on a top-level ...
Adam's user avatar
  • 1,947
0 votes
1 answer
73 views

How narrow from cursor to end of buffer?

M-x narrow-to-region - Narrow down to between point and mark But I need to narrow from cursor position to end of buffer. Is it possible?
a_subscriber's user avatar
  • 4,224
3 votes
2 answers
214 views

Delighting narrow-to-region possible?

I want to delight narrow-to-region. When I call org-toggle-narrow-to-subtree it calls org-narrow-to-subtree which calls narrow-to-region. When this is called the modeline shows "Narrow". Is there a ...
Jens Lange's user avatar
1 vote
1 answer
92 views

Switch back to default font on widening

Running emacs 25.2.2 on Kubuntu 17.10. I have an Org mode file that is mostly in English but certain headlines contain text in Devanagari. From Options -> Set Default Font, I have chosen Hack 13 ...
deshmukh's user avatar
  • 1,922
4 votes
1 answer
282 views

Frame specific narrowing

I'm using make-frame-on-display for collaborative editing with a colleague. Everything seems to work OK, but to avoid confusion we tend not to edit the exact part of the same file at the same time. ...
Daniel's user avatar
  • 3,673
2 votes
1 answer
54 views

Query-replace in multiple LaTeX environments, narrowing each in turn

I am trying to come up with a Elisp function that narrows a buffer to a certain LaTeX enviroment (table, figures, ...), does some query-replace-regexp inside the narrowing, then searches for the next ...
user17033's user avatar
1 vote
1 answer
426 views

What is the mode or the command to selectively display selected region?

There seems to be a command to display only the text in the selected region, leaving the rest of the text hidden. What is the command?
dragon's user avatar
  • 23
4 votes
2 answers
568 views

How to show part of buffer in different buffer?

I have a buffer with some data. I want to select part of buffer and open the selection in different buffer (and window) to make it easier to read for me. Is there some function that does it? I am ...
MatthewRock's user avatar
  • 1,523
1 vote
1 answer
568 views

How to indicate if narrow-to-region is currently in effect

I have advised the narrow and widen functions so that the fringe color indicates if narrowing is active: (advice-add 'narrow-to-region :after '(lambda (&rest args) (set-...
Tom's user avatar
  • 45
1 vote
1 answer
222 views

Narrowing two consecutive trees in org-mode

It is well known that one can narrow a subtree with Ctrl-xns. Is it possible to narrow two consecutive trees? How?
Dox's user avatar
  • 995
1 vote
0 answers
59 views

What is the cause of this inconsistent behaviour of TeX-command-buffer when narrowing?

When editing medium sized .tex files, I often find it convenient to make use of the narrow command C-x n n (narrow-to-region), usually in combination with the mark section command C-c * (LaTeX-mark-...
Jonas Dahlbæk's user avatar
6 votes
1 answer
381 views

How to save a desktop with narrowed indirect buffers?

I am unable to figure out a way to save my narrowed indirect buffer window, and restore it as it was. Say I have a frame with several windows containing several indirect buffers, each narrowed to a ...
Novus's user avatar
  • 107
2 votes
1 answer
208 views

Narrow and move between latex environments

When writing LaTeX presentations with the beamer class in emacs+auctex I would like to have a function (and keybinding) that does the following three things: narrow to the next frame environment if ...
Laurent's user avatar
  • 67
21 votes
3 answers
2k views

Can I have two views on a file - one narrowed one not?

I am editing some file, abc.org, and call org-narrow-to-block to narrow to a code block that I want to edit. For the editing process I have to access another part of abc.org and just want to show it ...
Matthias's user avatar
  • 785
4 votes
1 answer
333 views

Preserve original line numbering for a narrowed region

I noticed that whenever I narrow a region in emacs, the line numbering is relative to the narrowed region rather than being relative to the original file. Is there any way I can preserve the line ...
Chakravarthy Raghunandan's user avatar
6 votes
1 answer
325 views

Syntax highlight narrowed python string literals as code

I have some python code, that has some long string literals containing more python code. These strings should most of the time be uniformly colored, as happens by default. However, I would like to be ...
jmlorenzi's user avatar
  • 293
2 votes
0 answers
72 views

Restoring position in window after narrowing

C-x n w (widen) does not restore the position of a formerly narrowed region in relation to the window, as it was before calling C-x n n (narrow-to-region). Is it possible to have such behaviour? ...
Eleno's user avatar
  • 1,478
6 votes
3 answers
819 views

How to narrow to python class?

How can I narrow a buffer to the python class at point? narrow-to-region works but requires first selecting the class as a region, and it seems python-mode has moved on since this was written: http:/...
Croad Langshan's user avatar
7 votes
3 answers
355 views

How can I hide indentation on a narrowed defun?

When I'm in the middle of implementing a new function, I like to narrow my source buffer to just that function (C-x n d). However, this leaves the function indented as it was. I would like to have ...
J David Smith's user avatar
8 votes
2 answers
474 views

Narrow to previous restriction

Is there a convenient way to restore the previous restriction? So after the following sequence of events: Mark a region Call narrow-to-region and do some work. Call widen to jump around and look for ...
glucas's user avatar
  • 20.9k
8 votes
5 answers
2k views

How do I search in search results

When I C-s I can search. How should I do a function which I could bind for example to C-r which would let me search in the results of some predefined search query? Like contents of window would be: ...
lukas.pukenis's user avatar