* Re: [Emacs-diffs] master abd1825: Ensure that we can find definitions when buffer is narrowed [not found] ` <20171210145424.0E878211A6@vcs0.savannah.gnu.org> @ 2017-12-11 20:23 ` Charles A. Roelli 2017-12-12 15:11 ` Dmitry Gutov 0 siblings, 1 reply; 6+ messages in thread From: Charles A. Roelli @ 2017-12-11 20:23 UTC (permalink / raw) To: Wilfred Hughes; +Cc: emacs-devel > Date: Sun, 10 Dec 2017 09:54:23 -0500 (EST) > From: me@wilfred.me.uk (Wilfred Hughes) > > branch: master > commit abd18254aec76b26e86ae27e91d2c916ec20cc46 > Author: Wilfred Hughes <me@wilfred.me.uk> > Commit: Wilfred Hughes <me@wilfred.me.uk> > > Ensure that we can find definitions when buffer is narrowed > > find-function-search-for-symbol will reuse the existing buffer if > we've already opened the file that contains this symbol. However, if > the user has narrowed that buffer, we can't find definitions outside > the narrowed area. > > Instead, search the whole file to find definitions, and teach the help > buttons to widen if necessary. > > * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol): > Search the whole buffer for the target symbol. > > * lisp/help-mode.el: Help buttons now widen the target buffer, if > narrowing is in effect and the target position is not in that range. > --- > lisp/emacs-lisp/find-func.el | 46 +++++++++++++++++++++++--------------------- > lisp/help-mode.el | 45 ++++++++++++++++++++++++++++++------------- > 2 files changed, 56 insertions(+), 35 deletions(-) Thanks for fixing this. If I may suggest it, it might also be useful for these functions to respect `widen-automatically': widen-automatically is a variable defined in ‘simple.el’. Its value is t Documentation: Non-nil means it is ok for commands to call ‘widen’ when they want to. Some commands will do this in order to go to positions outside the current accessible part of the buffer. If ‘widen-automatically’ is nil, these commands will do something else as a fallback, and won’t change the buffer bounds. Also, I wonder if it would be worth the trouble to define a buffer-local ring of narrowings, so that a user could return to a previous narrowing after executing a command that changes to a different one. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Emacs-diffs] master abd1825: Ensure that we can find definitions when buffer is narrowed 2017-12-11 20:23 ` [Emacs-diffs] master abd1825: Ensure that we can find definitions when buffer is narrowed Charles A. Roelli @ 2017-12-12 15:11 ` Dmitry Gutov 2017-12-12 19:25 ` Charles A. Roelli 2017-12-12 20:56 ` Stefan Monnier 0 siblings, 2 replies; 6+ messages in thread From: Dmitry Gutov @ 2017-12-12 15:11 UTC (permalink / raw) To: Charles A. Roelli, Wilfred Hughes; +Cc: emacs-devel On 12/11/17 10:23 PM, Charles A. Roelli wrote: > Thanks for fixing this. If I may suggest it, it might also be useful > for these functions to respect `widen-automatically': Probably not find-function-search-for-symbol though? > widen-automatically is a variable defined in ‘simple.el’. > Its value is t > > Documentation: > Non-nil means it is ok for commands to call ‘widen’ when they want to. > Some commands will do this in order to go to positions outside > the current accessible part of the buffer. > > If ‘widen-automatically’ is nil, these commands will do something else > as a fallback, and won’t change the buffer bounds. I wonder if we're using this variable in all the places we should. A recent, heated discussion comes to mind. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Emacs-diffs] master abd1825: Ensure that we can find definitions when buffer is narrowed 2017-12-12 15:11 ` Dmitry Gutov @ 2017-12-12 19:25 ` Charles A. Roelli 2017-12-12 20:56 ` Stefan Monnier 1 sibling, 0 replies; 6+ messages in thread From: Charles A. Roelli @ 2017-12-12 19:25 UTC (permalink / raw) To: Dmitry Gutov; +Cc: me, emacs-devel > From: Dmitry Gutov <dgutov@yandex.ru> > Date: Tue, 12 Dec 2017 17:11:29 +0200 > > On 12/11/17 10:23 PM, Charles A. Roelli wrote: > > > Thanks for fixing this. If I may suggest it, it might also be useful > > for these functions to respect `widen-automatically': > > Probably not find-function-search-for-symbol though? Yes, you are right. > > widen-automatically is a variable defined in ‘simple.el’. > > Its value is t > > > > Documentation: > > Non-nil means it is ok for commands to call ‘widen’ when they want to. > > Some commands will do this in order to go to positions outside > > the current accessible part of the buffer. > > > > If ‘widen-automatically’ is nil, these commands will do something else > > as a fallback, and won’t change the buffer bounds. > > I wonder if we're using this variable in all the places we should. Not sure. Maybe the first step would be to document it and make it customizable, so that people can find it. Then we can add support for it in places that lack it. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Emacs-diffs] master abd1825: Ensure that we can find definitions when buffer is narrowed 2017-12-12 15:11 ` Dmitry Gutov 2017-12-12 19:25 ` Charles A. Roelli @ 2017-12-12 20:56 ` Stefan Monnier 2017-12-13 20:16 ` Charles A. Roelli 1 sibling, 1 reply; 6+ messages in thread From: Stefan Monnier @ 2017-12-12 20:56 UTC (permalink / raw) To: emacs-devel >> Non-nil means it is ok for commands to call ‘widen’ when they want to. >> Some commands will do this in order to go to positions outside >> the current accessible part of the buffer. >> If ‘widen-automatically’ is nil, these commands will do something else >> as a fallback, and won’t change the buffer bounds. > I wonder if we're using this variable in all the places we should. > A recent, heated discussion comes to mind. Its docstring also doesn't really make it clear what it means and how to use it. Looking at the current users, a slightly different var might work better. E.g. (defvar widen-to-pos-function (lambda (pos) (if (not (<= (point-min) pos (point-max))) (widen)))) this would simplify the two places I could find which check the value of this var (xref and pop-global-mark). And it would let the only user who sets it (to nil) set it to a more useful value (a function which jumps to the page in which that position is visible). Also I think the docstring should clarify that it is meant for "user commands" (i.e. not to replace things like font-lock-dont-widen). Stefan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Emacs-diffs] master abd1825: Ensure that we can find definitions when buffer is narrowed 2017-12-12 20:56 ` Stefan Monnier @ 2017-12-13 20:16 ` Charles A. Roelli 2017-12-13 22:08 ` Stefan Monnier 0 siblings, 1 reply; 6+ messages in thread From: Charles A. Roelli @ 2017-12-13 20:16 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel > Its docstring also doesn't really make it clear what it means and how to > use it. Looking at the current users, a slightly different var might > work better. E.g. > (defvar widen-to-pos-function > (lambda (pos) > (if (not (<= (point-min) pos (point-max))) > (widen)))) Sounds good to me. What do you think would be better, to supplement widen-automatically with widen-to-pos-function, or remove widen-automatically and only offer widen-to-pos-function? From a user's perspective, it might be useful to keep both around (allowing widen-automatically to easily be set to nil in some buffers where it's unwanted). ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Emacs-diffs] master abd1825: Ensure that we can find definitions when buffer is narrowed 2017-12-13 20:16 ` Charles A. Roelli @ 2017-12-13 22:08 ` Stefan Monnier 0 siblings, 0 replies; 6+ messages in thread From: Stefan Monnier @ 2017-12-13 22:08 UTC (permalink / raw) To: Charles A. Roelli; +Cc: emacs-devel > From a user's perspective, it might be useful to keep both around > (allowing widen-automatically to easily be set to nil in some buffers > where it's unwanted). (setq-local widen-to-pos-function #'ignore) would work just as well. Stefan ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-12-13 22:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20171210145422.30001.90205@vcs0.savannah.gnu.org> [not found] ` <20171210145424.0E878211A6@vcs0.savannah.gnu.org> 2017-12-11 20:23 ` [Emacs-diffs] master abd1825: Ensure that we can find definitions when buffer is narrowed Charles A. Roelli 2017-12-12 15:11 ` Dmitry Gutov 2017-12-12 19:25 ` Charles A. Roelli 2017-12-12 20:56 ` Stefan Monnier 2017-12-13 20:16 ` Charles A. Roelli 2017-12-13 22:08 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).