2

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?

EDIT: The effect should be as if C-x n n and C-x n w were wrapped into a save-excursion form, I guess. If the first line of the region was the nth line of the window then, after widening, it should return to be the nth line of the window. Point should keep its position relative to the formerly narrowed region.

Eleno
  • 1,448
  • 11
  • 17
  • 1
    Are you primarily interested in window-start point remaining the same? If edits are made to the narrowed region, things are naturally going to be changing when widened. Or, are you most interested in placing point at the beginning or ending of where the region was initially narrowed (before edits were made) -- and if so, which one? Do you want the window point to be centered? Any other details on the desired result would be helpful. – lawlist Jun 29 '15 at 23:16
  • Advice both functions to save and restore, I guess, window-start and point. – politza Jun 29 '15 at 23:53
  • @lawlist I have added some clarifications. Hopefully, my question is clearer now. – Eleno Jun 30 '15 at 00:02
  • 1
    I think it makes sense only when the size of the narrowed region is small and doesn't change much. In particular if you narrow to the current line. example code for that case at https://lists.gnu.org/archive/html/bug-gnu-emacs/2015-06/msg00090.html – YoungFrog Jun 30 '15 at 02:53
  • @YoungFrog: Yes, that code accomplishes what I am trying to do. Thanks. – Eleno Jun 30 '15 at 08:52

0 Answers0