all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Isearch setting of inhibit-point-motion-hooks too inflexible
@ 2002-10-27 11:45 Gregor Schmid
  2002-10-28 19:20 ` Richard Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: Gregor Schmid @ 2002-10-27 11:45 UTC (permalink / raw)



Dear emacs maintainers,

since emacs version 20 isearch has had new capabilities for optionally
matching invisible text, plus additional features that work well with
outline and hideout. This mechanism requires setting
`inhibit-point-motion-hooks' to the value of `search-invisible' in
`isearch-search'.

However, I'm using a homegrown folding mode that makes use of the
'invisible text property and depends on the point motion hooks _not_
being inhibited. It works well with isearch, provided that
`search-invisible' is t and `inhibit-point-motion-hooks' is nil during 
`isearch-search'. With the current implementation of `isearch-search' 
this is not possible.

The following patch against emacs 21.2 will add a new variable
`isearch-inhibit-point-motion-hooks' and change `isearch-search' to
make use of it. Comments should be self-explanatory. The default
settings will maintain the current behaviour.

Best regards,
     Greg

----------ChangeLog-----------------------------------------


2002-10-27  Gregor Schmid <gs@qfs.de>

	* isearch.el (isearch-inhibit-point-motion-hooks): New variable
	(isearch-search): Make use of isearch-inhibit-point-motion-hooks


----------Patch---------------------------------------------
cd /usr/local/share/emacs/21.2/lisp/
diff -c -p -w /usr/local/share/emacs/21.2/lisp/isearch.el\~ /usr/local/share/emacs/21.2/lisp/isearch.el
*** /usr/local/share/emacs/21.2/lisp/isearch.el~	Thu Oct 18 12:06:56 2001
--- /usr/local/share/emacs/21.2/lisp/isearch.el	Sun Oct 27 12:05:37 2002
*************** Ordinarily the text becomes invisible ag
*** 186,191 ****
--- 186,199 ----
    :type 'boolean
    :group 'isearch)
  
+ (defvar isearch-inhibit-point-motion-hooks 'search-invisible
+   "If t `inhibit-point-motion-hooks' is set during search.
+ nil means don't set `inhibit-point-motion-hooks'.
+ For any other value (the default) `inhibit-point-motion-hooks' is set to
+ the value of `search-invisible'.
+ This variable only needs to be changed for custom modes that use
+ invisible text and depend on point motion hooks for operation.")
+ 
  (defvar isearch-mode-hook nil
    "Function(s) to call after starting up an incremental search.")
  
*************** If there is no completion possible, say 
*** 1577,1583 ****
        (setq isearch-case-fold-search
  	    (isearch-no-upper-case-p isearch-string isearch-regexp)))
    (condition-case lossage
!       (let ((inhibit-point-motion-hooks search-invisible)
  	    (inhibit-quit nil)
  	    (case-fold-search isearch-case-fold-search)
  	    (retry t))
--- 1585,1597 ----
        (setq isearch-case-fold-search
  	    (isearch-no-upper-case-p isearch-string isearch-regexp)))
    (condition-case lossage
!       (let ((inhibit-point-motion-hooks
! 	     (cond
! 		  ((null isearch-inhibit-point-motion-hooks)
! 		   nil)
! 		  ((eq isearch-inhibit-point-motion-hooks t)
! 		   t)
! 		  (t search-invisible)))
  	    (inhibit-quit nil)
  	    (case-fold-search isearch-case-fold-search)
  	    (retry t))

Diff finished at Sun Oct 27 12:20:01
------------------------------------------------------------

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Isearch setting of inhibit-point-motion-hooks too inflexible
  2002-10-27 11:45 Isearch setting of inhibit-point-motion-hooks too inflexible Gregor Schmid
@ 2002-10-28 19:20 ` Richard Stallman
  2002-10-29  7:46   ` Gregor Schmid
  2002-10-29 14:14   ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Richard Stallman @ 2002-10-28 19:20 UTC (permalink / raw)
  Cc: emacs-devel

    The following patch against emacs 21.2 will add a new variable
    `isearch-inhibit-point-motion-hooks' and change `isearch-search' to
    make use of it.

That would solve your problem, but since it is an all-or-nothing
choice, we must expect that people using multiple packages will find
that neither t nor nil gives good results for all of those packages.

I wonder if we can find a solution where a single mode
will work with various packages.  Does someone recall why
isearch currently wants inhibit-point-motion-hooks to be t
if it can match in invisible text?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Isearch setting of inhibit-point-motion-hooks too inflexible
  2002-10-28 19:20 ` Richard Stallman
@ 2002-10-29  7:46   ` Gregor Schmid
  2002-10-30 17:16     ` Richard Stallman
  2002-10-29 14:14   ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: Gregor Schmid @ 2002-10-29  7:46 UTC (permalink / raw)
  Cc: Gregor.Schmid, emacs-devel


Dear Richard,

Richard Stallman <rms@gnu.org> writes:

>     The following patch against emacs 21.2 will add a new variable
>     `isearch-inhibit-point-motion-hooks' and change `isearch-search' to
>     make use of it.
> 
> That would solve your problem, but since it is an all-or-nothing
> choice, we must expect that people using multiple packages will find
> that neither t nor nil gives good results for all of those packages.

Correct me if I'm wrong, but wouldn't 
(make-local-variable 'isearch-inhibit-point-motion-hooks)
solve this if some mode needs a non-default behavior? I don't think
folding/outline type packages can be combined in one buffer anyway.

Best regards,
    Greg

-- 
Gregor Schmid                           Gregor.Schmid@qfs.de
Quality First Software GmbH                http://www.qfs.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Isearch setting of inhibit-point-motion-hooks too inflexible
  2002-10-28 19:20 ` Richard Stallman
  2002-10-29  7:46   ` Gregor Schmid
@ 2002-10-29 14:14   ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2002-10-29 14:14 UTC (permalink / raw)
  Cc: Gregor.Schmid, emacs-devel

>     The following patch against emacs 21.2 will add a new variable
>     `isearch-inhibit-point-motion-hooks' and change `isearch-search' to
>     make use of it.
> 
> That would solve your problem, but since it is an all-or-nothing
> choice, we must expect that people using multiple packages will find
> that neither t nor nil gives good results for all of those packages.
> 
> I wonder if we can find a solution where a single mode
> will work with various packages.  Does someone recall why
> isearch currently wants inhibit-point-motion-hooks to be t
> if it can match in invisible text?

I think it's for intangible text (i.e. it doesn't just allow to
search in invisible text but also in invisible+intangible).
At least, the code is careful to make text tangible if it wasn't
before.


	Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Isearch setting of inhibit-point-motion-hooks too inflexible
  2002-10-29  7:46   ` Gregor Schmid
@ 2002-10-30 17:16     ` Richard Stallman
  2002-10-30 18:34       ` Stefan Monnier
  2002-10-31  8:23       ` Gregor Schmid
  0 siblings, 2 replies; 8+ messages in thread
From: Richard Stallman @ 2002-10-30 17:16 UTC (permalink / raw)
  Cc: Gregor.Schmid, emacs-devel

    Correct me if I'm wrong, but wouldn't 
    (make-local-variable 'isearch-inhibit-point-motion-hooks)
    solve this if some mode needs a non-default behavior?

If a particular major mode wants a non-default behavior, this would
do it.  But these features are not always major modes.  Can we use
an overlay property to make the decision?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Isearch setting of inhibit-point-motion-hooks too inflexible
  2002-10-30 17:16     ` Richard Stallman
@ 2002-10-30 18:34       ` Stefan Monnier
  2002-10-31 17:27         ` Richard Stallman
  2002-10-31  8:23       ` Gregor Schmid
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2002-10-30 18:34 UTC (permalink / raw)
  Cc: Gregor.Schmid, emacs-devel

>     Correct me if I'm wrong, but wouldn't 
>     (make-local-variable 'isearch-inhibit-point-motion-hooks)
>     solve this if some mode needs a non-default behavior?
> 
> If a particular major mode wants a non-default behavior, this would
> do it.  But these features are not always major modes.  Can we use
> an overlay property to make the decision?

Since this thing is used by isearch in order to look inside
intangible text, I think it should simply be removed:
isearch should *not* look inside intangible text.

As we have discussed in this group at length, `intangible' is a very
strong statement and has far reaching implications.  It should be
used very sparingly.


	Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Isearch setting of inhibit-point-motion-hooks too inflexible
  2002-10-30 17:16     ` Richard Stallman
  2002-10-30 18:34       ` Stefan Monnier
@ 2002-10-31  8:23       ` Gregor Schmid
  1 sibling, 0 replies; 8+ messages in thread
From: Gregor Schmid @ 2002-10-31  8:23 UTC (permalink / raw)
  Cc: emacs-devel


Dear Richard, dear Stefan,

Richard Stallman <rms@gnu.org> writes:
>     Correct me if I'm wrong, but wouldn't 
>     (make-local-variable 'isearch-inhibit-point-motion-hooks)
>     solve this if some mode needs a non-default behavior?
> 
> If a particular major mode wants a non-default behavior, this would
> do it.  But these features are not always major modes.  Can we use
> an overlay property to make the decision?

Possibly. But consider Stefan's comment:

"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:
> Since this thing is used by isearch in order to look inside
> intangible text, I think it should simply be removed:
> isearch should *not* look inside intangible text.
> 
> As we have discussed in this group at length, `intangible' is a very
> strong statement and has far reaching implications.  It should be
> used very sparingly.

My favourite soultion would also be to simply remove any manipulation
of inhibit-point-motion-hooks from isearch-search.

If you decide to leave it in and make it more flexible than with my
suggested patch, e.g. thorugh overlays, please also add a simple
option that just requires setting some variable, so as to keep the
simple case simple. Whatever the solution, anything will be better
than the current totally inflexible scheme.

Thanks for addressing this issue, best regards,
    Greg

-- 
Gregor Schmid                           Gregor.Schmid@qfs.de
Quality First Software GmbH                http://www.qfs.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Isearch setting of inhibit-point-motion-hooks too inflexible
  2002-10-30 18:34       ` Stefan Monnier
@ 2002-10-31 17:27         ` Richard Stallman
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2002-10-31 17:27 UTC (permalink / raw)
  Cc: Gregor.Schmid, emacs-devel

    Since this thing is used by isearch in order to look inside
    intangible text, I think it should simply be removed:
    isearch should *not* look inside intangible text.

You might perhaps be right, but I am not convinced.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-10-31 17:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-27 11:45 Isearch setting of inhibit-point-motion-hooks too inflexible Gregor Schmid
2002-10-28 19:20 ` Richard Stallman
2002-10-29  7:46   ` Gregor Schmid
2002-10-30 17:16     ` Richard Stallman
2002-10-30 18:34       ` Stefan Monnier
2002-10-31 17:27         ` Richard Stallman
2002-10-31  8:23       ` Gregor Schmid
2002-10-29 14:14   ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.