* bug#15245: Search and replace, but based on text properties (inclulding face properties) @ 2013-09-02 5:21 Jambunathan K 2013-09-02 15:29 ` Drew Adams 2013-11-15 4:55 ` Jambunathan K 0 siblings, 2 replies; 9+ messages in thread From: Jambunathan K @ 2013-09-02 5:21 UTC (permalink / raw) To: 15245 The underlying use-case on how such a feature could be put to good use is explained in the following bug (which is filed against eww) http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15244 ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#15245: Search and replace, but based on text properties (inclulding face properties) 2013-09-02 5:21 bug#15245: Search and replace, but based on text properties (inclulding face properties) Jambunathan K @ 2013-09-02 15:29 ` Drew Adams 2013-09-02 17:12 ` Jambunathan K 2013-11-15 4:55 ` Jambunathan K 1 sibling, 1 reply; 9+ messages in thread From: Drew Adams @ 2013-09-02 15:29 UTC (permalink / raw) To: Jambunathan K, 15245 > The underlying use-case on how such a feature could be put to good use > is explained in the following bug (which is filed against eww) > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15244 FWIW, this feature is available in isearch+.el since 2011. It could be incorporated into vanilla Emacs. From the Commentary: ;; * Ability to search within character-property zones. Example: ;; search within zones having a `face' text property with a value ;; of `font-lock-comment-face' or `font-lock-string-face'. Search ;; overlays or text properties. From within Isearch: `C-t' (or ;; `C-M-t' for regexp search). First time, or with a prefix ;; argument, you are prompted for the property and its values. See ;; the doc string of command `isearchp-char-prop-forward'. ;; ;; * Besides relying on other code to set `face' and other text ;; properties for use with `C-t', you can use command ;; `isearchp-put-prop-on-region' (outside of Isearch) to add a text ;; property to a zone of text. By default, it applies the last ;; property and value whose zones you searched using `C-t', but a ;; prefix arg lets you specify the property and value to apply. ;; This gives you an interactive way to set up zones for ;; text-property search (`C-t'). For property `face', empty input ;; removes all faces from the region. Code: http://www.emacswiki.org/emacs/download/isearch%2b.el More description: http://www.emacswiki.org/IsearchPlus ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#15245: Search and replace, but based on text properties (inclulding face properties) 2013-09-02 15:29 ` Drew Adams @ 2013-09-02 17:12 ` Jambunathan K 2013-09-02 18:01 ` Drew Adams 0 siblings, 1 reply; 9+ messages in thread From: Jambunathan K @ 2013-09-02 17:12 UTC (permalink / raw) To: Drew Adams; +Cc: 15245 Drew Adams <drew.adams@oracle.com> writes: > It could be incorporated into vanilla Emacs. Does this mean you are offering it up as a patch to Emacs? If *yes*, I am willing to give it a test run. ---------------------------------------------------------------- Btw, can it convert the HTML rendered by eww in to let's say Oddmuse, Creole or Markdown formats? By text properties, it need not necessarily be faces it can be any other text property (that stores some data) ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#15245: Search and replace, but based on text properties (inclulding face properties) 2013-09-02 17:12 ` Jambunathan K @ 2013-09-02 18:01 ` Drew Adams 2013-09-02 18:25 ` Jambunathan K 0 siblings, 1 reply; 9+ messages in thread From: Drew Adams @ 2013-09-02 18:01 UTC (permalink / raw) To: Jambunathan K; +Cc: 15245 > > It could be incorporated into vanilla Emacs. > > Does this mean you are offering it up as a patch to Emacs? If *yes*, I > am willing to give it a test run. Yes, of course. I have offered my code generally. > Btw, can it convert the HTML rendered by eww in to let's say Oddmuse, > Creole or Markdown formats? No idea, and I know almost nothing about eww, Oddmuse, and Creole. Also, when you say "convert" it makes me realize that you asked about search and *replace*, not just search. Not sure what you have in mind there. To be clear, this feature does only search. It just limits the contexts to be searched to buffer zones that have given text or overlay properties. For example, you can search for `en' within zones that have either face `font-lock-keyword-face' or face `font-lock-comment-face' (or whatever). > By text properties, it need not necessarily be faces it can be any > other text property (that stores some data) Correct; it is not limited to property `face'. From the description: Besides relying on other code to set 'face' and other text properties for use with 'C-t', you can use command 'isearchp-put-prop-on-region' (outside of Isearch) to add a text property to a zone of text. By default, it applies the last property and value whose zones you searched using 'C-t', but a prefix argument lets you specify the property and value to apply. This gives you an interactive way to set up zones for text-property search ('C-t'). For property 'face', empty input removes all faces from the region. And for properties `face' and `font-lock-face', you can pick multiple faces, as in the example I mentioned above. Text is searched that has a face text (or perhaps overlay) property that includes any of the faces you choose. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#15245: Search and replace, but based on text properties (inclulding face properties) 2013-09-02 18:01 ` Drew Adams @ 2013-09-02 18:25 ` Jambunathan K 2013-09-02 18:43 ` Drew Adams 0 siblings, 1 reply; 9+ messages in thread From: Jambunathan K @ 2013-09-02 18:25 UTC (permalink / raw) To: Drew Adams; +Cc: 15245 Drew Adams <drew.adams@oracle.com> writes: > Also, when you say "convert" it makes me realize that you asked about > search and *replace*, not just search. Not sure what you have in mind > there. The idea is a quick and dirty to convert a text rendered by eww in to Org format. ---------------------------------------------------------------- For example, if eww read <b> bold text </b> and converted it to bold text (Imagine a bold face) I can do a search and replace on bold text property and get *bold* which is the Org equivalent for a bold markup. ---------------------------------------------------------------- For example, if eww read <h2> level 2 headline </h2> and converted it to level 2 headline (Imagine a bold face, but with text property :tag h2) I can do a search and replace on h2 property and end up with ** level 2 headline which is the Org equivalent for a headline. If it was Creole or Oddmuse it will be (I think) == level 2 headline ---------------------------------------------------------------- This is a quick and dirty way of "importing" an HTML document in to plain markup text. I have a feeling that it can be useful. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#15245: Search and replace, but based on text properties (inclulding face properties) 2013-09-02 18:25 ` Jambunathan K @ 2013-09-02 18:43 ` Drew Adams 2013-09-02 19:44 ` Juri Linkov 0 siblings, 1 reply; 9+ messages in thread From: Drew Adams @ 2013-09-02 18:43 UTC (permalink / raw) To: Jambunathan K; +Cc: 15245 > > Also, when you say "convert" it makes me realize that you asked about > > search and *replace*, not just search. Not sure what you have in mind > > there. [snip - explanation of what was meant] > This is a quick and dirty way of "importing" an HTML document in to > plain markup text. I have a feeling that it can be useful. I see. Well the Isearch feature I suggested won't really help with that. You can of course use `M-%' in Isearch to kick into a query-replace. But `query-replace' just picks up the last search string. It has no notion of search contexts, AFAIK. Now maybe things could also be tweaked to make `query-replace' respect such contexts. In the case of character-property searching, that would mean making `query-replace' sensitive somehow to `isearch-filter-predicate'. Perhaps Juri has a suggestion in this regard. He's pretty much the resident expert on Isearch. Or perhaps you see a solution wrt this. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#15245: Search and replace, but based on text properties (inclulding face properties) 2013-09-02 18:43 ` Drew Adams @ 2013-09-02 19:44 ` Juri Linkov 2013-09-02 20:03 ` Drew Adams 0 siblings, 1 reply; 9+ messages in thread From: Juri Linkov @ 2013-09-02 19:44 UTC (permalink / raw) To: Drew Adams; +Cc: Jambunathan K, 15245 > Now maybe things could also be tweaked to make `query-replace' respect > such contexts. In the case of character-property searching, that would It should be easy now to respect such contexts with text properties in `query-replace' using `isearch-filter-predicate'. I'll post an example shortly. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#15245: Search and replace, but based on text properties (inclulding face properties) 2013-09-02 19:44 ` Juri Linkov @ 2013-09-02 20:03 ` Drew Adams 0 siblings, 0 replies; 9+ messages in thread From: Drew Adams @ 2013-09-02 20:03 UTC (permalink / raw) To: Juri Linkov; +Cc: Jambunathan K, 15245 > > Now maybe things could also be tweaked to make `query-replace' respect > > such contexts. In the case of character-property searching, that would > > It should be easy now to respect such contexts with text > properties in `query-replace' using `isearch-filter-predicate'. > I'll post an example shortly. Excellent. I was hoping you might say something like that. Haven't been following all the changes you've made to Isearch etc. recently, but I was wondering if something like this wasn't possible now. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#15245: Search and replace, but based on text properties (inclulding face properties) 2013-09-02 5:21 bug#15245: Search and replace, but based on text properties (inclulding face properties) Jambunathan K 2013-09-02 15:29 ` Drew Adams @ 2013-11-15 4:55 ` Jambunathan K 1 sibling, 0 replies; 9+ messages in thread From: Jambunathan K @ 2013-11-15 4:55 UTC (permalink / raw) To: 15245-done OP here. Closed. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-11-15 4:55 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-09-02 5:21 bug#15245: Search and replace, but based on text properties (inclulding face properties) Jambunathan K 2013-09-02 15:29 ` Drew Adams 2013-09-02 17:12 ` Jambunathan K 2013-09-02 18:01 ` Drew Adams 2013-09-02 18:25 ` Jambunathan K 2013-09-02 18:43 ` Drew Adams 2013-09-02 19:44 ` Juri Linkov 2013-09-02 20:03 ` Drew Adams 2013-11-15 4:55 ` Jambunathan K
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.