unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16258: 24.3.50;[PATCH] eww: Add new function of region-search.
@ 2013-12-26  3:11 Kenjiro NAKAYAMA
  2013-12-26 13:11 ` bug#16258: 24.3.50; [PATCH] " Kenjiro NAKAYAMA
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Kenjiro NAKAYAMA @ 2013-12-26  3:11 UTC (permalink / raw)
  To: 16258

I think the function to search the selected word withought any input is useful.
But it might be a good idea to set this function in .emacs.el or init.el by
users. So please judge this function should apply or reject.
I send the patch.

Signed-off-by: Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>

        * net/eww.el(eww-search-region): New function to search region.
        (eww-mode-map): New key map to eww-search-region.
          
---
 lisp/net/eww.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 25309d1..f5ca8b1 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -433,6 +433,7 @@ word(s) will be searched for via `eww-search-prefix'."
     (define-key map "B" 'eww-list-bookmarks)
     (define-key map [(meta n)] 'eww-next-bookmark)
     (define-key map [(meta p)] 'eww-previous-bookmark)
+    (define-key map [(meta s)(meta s)] 'eww-search-region)
 
     (easy-menu-define nil map ""
       '("Eww"
@@ -1358,6 +1359,12 @@ Differences in #targets are ignored."
   (setq buffer-read-only t
 	truncate-lines t))
 
+;; Utilities
+
+(defun eww-search-region (&optional beg end)
+  (interactive "r")
+  (eww (buffer-substring beg end)))
+
 (provide 'eww)
 
 ;;; eww.el ends here
-- 
1.8.3.1





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2013-12-26  3:11 bug#16258: 24.3.50;[PATCH] eww: Add new function of region-search Kenjiro NAKAYAMA
@ 2013-12-26 13:11 ` Kenjiro NAKAYAMA
  2013-12-26 13:56 ` Lars Ingebrigtsen
  2014-11-14  3:47 ` Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 17+ messages in thread
From: Kenjiro NAKAYAMA @ 2013-12-26 13:11 UTC (permalink / raw)
  To: Kenjiro NAKAYAMA; +Cc: 16258

Sorr, since this is new functionality, I should have sent after the feature
freeze is over.

nakayamakenjiro@gmail.com writes:

> I think the function to search the selected word withought any input is useful.
> But it might be a good idea to set this function in .emacs.el or init.el by
> users. So please judge this function should apply or reject.
> I send the patch.
>
> Signed-off-by: Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
>
>         * net/eww.el(eww-search-region): New function to search region.
>         (eww-mode-map): New key map to eww-search-region.
>           
> ---
>  lisp/net/eww.el | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/lisp/net/eww.el b/lisp/net/eww.el
> index 25309d1..f5ca8b1 100644
> --- a/lisp/net/eww.el
> +++ b/lisp/net/eww.el
> @@ -433,6 +433,7 @@ word(s) will be searched for via `eww-search-prefix'."
>      (define-key map "B" 'eww-list-bookmarks)
>      (define-key map [(meta n)] 'eww-next-bookmark)
>      (define-key map [(meta p)] 'eww-previous-bookmark)
> +    (define-key map [(meta s)(meta s)] 'eww-search-region)
>  
>      (easy-menu-define nil map ""
>        '("Eww"
> @@ -1358,6 +1359,12 @@ Differences in #targets are ignored."
>    (setq buffer-read-only t
>  	truncate-lines t))
>  
> +;; Utilities
> +
> +(defun eww-search-region (&optional beg end)
> +  (interactive "r")
> +  (eww (buffer-substring beg end)))
> +
>  (provide 'eww)
>  
>  ;;; eww.el ends here






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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2013-12-26  3:11 bug#16258: 24.3.50;[PATCH] eww: Add new function of region-search Kenjiro NAKAYAMA
  2013-12-26 13:11 ` bug#16258: 24.3.50; [PATCH] " Kenjiro NAKAYAMA
@ 2013-12-26 13:56 ` Lars Ingebrigtsen
  2013-12-26 23:43   ` Kenjiro NAKAYAMA
  2014-11-14  3:47 ` Lars Magne Ingebrigtsen
  2 siblings, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2013-12-26 13:56 UTC (permalink / raw)
  To: Kenjiro NAKAYAMA; +Cc: 16258

Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> writes:

> +    (define-key map [(meta s)(meta s)] 'eww-search-region)

[...]

> +(defun eww-search-region (&optional beg end)
> +  (interactive "r")
> +  (eww (buffer-substring beg end)))

Hm...  so this would just use the default search engine to search for
whatever is in the region?  I'm not sure that that's a useful eww mode
command, but it might be a useful global command...

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2013-12-26 13:56 ` Lars Ingebrigtsen
@ 2013-12-26 23:43   ` Kenjiro NAKAYAMA
  2013-12-27  1:46     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 17+ messages in thread
From: Kenjiro NAKAYAMA @ 2013-12-26 23:43 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16258, Kenjiro NAKAYAMA

> Hm...  so this would just use the default search engine to search for
> whatever is in the region?

Yes, that's right. It is not big function, sorry...

> I'm not sure that that's a useful eww mode
> command, but it might be a useful global command...

Then, how about delete the key map and include the eww-search-region?
I want to know how much eww should provide its utilities like this function.

* delete
 >> +    (define-key map [(meta s)(meta s)] 'eww-search-region)

* remain
 >> +(defun eww-search-region (&optional beg end)
 >> +  (interactive "r")
 >> +  (eww (buffer-substring beg end)))


Kenjiro

larsi@gnus.org writes:

> Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> writes:
>
>> +    (define-key map [(meta s)(meta s)] 'eww-search-region)
>
> [...]
>
>> +(defun eww-search-region (&optional beg end)
>> +  (interactive "r")
>> +  (eww (buffer-substring beg end)))
>
> Hm...  so this would just use the default search engine to search for
> whatever is in the region?  I'm not sure that that's a useful eww mode
> command, but it might be a useful global command...






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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2013-12-26 23:43   ` Kenjiro NAKAYAMA
@ 2013-12-27  1:46     ` Lars Ingebrigtsen
  2014-01-07 23:37       ` Ted Zlatanov
                         ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Lars Ingebrigtsen @ 2013-12-27  1:46 UTC (permalink / raw)
  To: Kenjiro NAKAYAMA; +Cc: 16258

Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> writes:

>> I'm not sure that that's a useful eww mode
>> command, but it might be a useful global command...
>
> Then, how about delete the key map and include the eww-search-region?
> I want to know how much eww should provide its utilities like this function.

Emacs is in a feature freeze, but I think it sounds like a very useful
thing to be able to just set a point and mark in any buffer, hit
`M-s M-s', and then be presented with the eww search results.  Others
will have to comment on the keystroke, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2013-12-27  1:46     ` Lars Ingebrigtsen
@ 2014-01-07 23:37       ` Ted Zlatanov
  2014-11-10 21:41       ` Lars Magne Ingebrigtsen
       [not found]       ` <m3h9y6g2dd.fsf@stories.gnus.org>
  2 siblings, 0 replies; 17+ messages in thread
From: Ted Zlatanov @ 2014-01-07 23:37 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16258, Kenjiro NAKAYAMA

On Fri, 27 Dec 2013 02:46:20 +0100 Lars Ingebrigtsen <larsi@gnus.org> wrote: 

LI> Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> writes:
>>> I'm not sure that that's a useful eww mode
>>> command, but it might be a useful global command...
>> 
>> Then, how about delete the key map and include the eww-search-region?
>> I want to know how much eww should provide its utilities like this function.

LI> Emacs is in a feature freeze, but I think it sounds like a very useful
LI> thing to be able to just set a point and mark in any buffer, hit
LI> `M-s M-s', and then be presented with the eww search results.  Others
LI> will have to comment on the keystroke, though.

I would use this happily.  The default keystroke doesn't matter too
much: I'll probably use `F2' and I imagine most people will want it on a
single key.  So please commit something like it after the feature freeze.

Ted





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2013-12-27  1:46     ` Lars Ingebrigtsen
  2014-01-07 23:37       ` Ted Zlatanov
@ 2014-11-10 21:41       ` Lars Magne Ingebrigtsen
       [not found]       ` <m3h9y6g2dd.fsf@stories.gnus.org>
  2 siblings, 0 replies; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-10 21:41 UTC (permalink / raw)
  To: Kenjiro NAKAYAMA; +Cc: 16258, emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> writes:
>
>>> I'm not sure that that's a useful eww mode
>>> command, but it might be a useful global command...
>>
>> Then, how about delete the key map and include the eww-search-region?
>> I want to know how much eww should provide its utilities like this function.
>
> Emacs is in a feature freeze, but I think it sounds like a very useful
> thing to be able to just set a point and mark in any buffer, hit
> `M-s M-s', and then be presented with the eww search results.  Others
> will have to comment on the keystroke, though.

Does anybody have an opinion on this feature?  I think it sounds useful,
but I have no idea what global keystroke we would want to bind this to.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
       [not found]       ` <m3h9y6g2dd.fsf@stories.gnus.org>
@ 2014-11-11  1:36         ` Stefan Monnier
       [not found]         ` <jwvfvdqeczj.fsf-monnier+emacsbugs@gnu.org>
  1 sibling, 0 replies; 17+ messages in thread
From: Stefan Monnier @ 2014-11-11  1:36 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 16258, Kenjiro NAKAYAMA, emacs-devel

> Does anybody have an opinion on this feature?  I think it sounds useful,
> but I have no idea what global keystroke we would want to bind this to.

We have the M-s prefix specifically for search-related commands, so
there's a lot of key-binding room.


        Stefan





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
       [not found]         ` <jwvfvdqeczj.fsf-monnier+emacsbugs@gnu.org>
@ 2014-11-11  2:42           ` Drew Adams
       [not found]           ` <15f0d58a-de8c-4aa7-b3f3-aa12662a8c58@default>
  1 sibling, 0 replies; 17+ messages in thread
From: Drew Adams @ 2014-11-11  2:42 UTC (permalink / raw)
  To: Stefan Monnier, Lars Magne Ingebrigtsen
  Cc: 16258, Kenjiro NAKAYAMA, emacs-devel

> > Does anybody have an opinion on this feature?  I think it sounds
> > useful,
> > but I have no idea what global keystroke we would want to bind
> > this to.
> 
> We have the M-s prefix specifically for search-related commands, so
> there's a lot of key-binding room.

I have no opinion on the feature.  But it should not be named `*-region-search'.  It does not search the region (IIUC).  It searches for the selected text.





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2013-12-26  3:11 bug#16258: 24.3.50;[PATCH] eww: Add new function of region-search Kenjiro NAKAYAMA
  2013-12-26 13:11 ` bug#16258: 24.3.50; [PATCH] " Kenjiro NAKAYAMA
  2013-12-26 13:56 ` Lars Ingebrigtsen
@ 2014-11-14  3:47 ` Lars Magne Ingebrigtsen
  2014-11-14  3:49   ` Lars Magne Ingebrigtsen
  2014-11-14 17:01   ` Stefan Monnier
  2 siblings, 2 replies; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-14  3:47 UTC (permalink / raw)
  To: Kenjiro NAKAYAMA; +Cc: 16258

Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> writes:

> +(defun eww-search-region (&optional beg end)
> +  (interactive "r")
> +  (eww (buffer-substring beg end)))

This has now been tweaked slightly and bound globally to `M-s M-s'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2014-11-14  3:47 ` Lars Magne Ingebrigtsen
@ 2014-11-14  3:49   ` Lars Magne Ingebrigtsen
  2014-11-14 17:01   ` Stefan Monnier
  1 sibling, 0 replies; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-14  3:49 UTC (permalink / raw)
  To: Kenjiro NAKAYAMA; +Cc: 16258

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> writes:
>
>> +(defun eww-search-region (&optional beg end)
>> +  (interactive "r")
>> +  (eww (buffer-substring beg end)))
>
> This has now been tweaked slightly and bound globally to `M-s M-s'.

Although perhaps something more should be done for Emacsen that doesn't
have eww available (i.e., without libxml2 support), but I don't know what.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2014-11-14  3:47 ` Lars Magne Ingebrigtsen
  2014-11-14  3:49   ` Lars Magne Ingebrigtsen
@ 2014-11-14 17:01   ` Stefan Monnier
  2014-11-15 19:26     ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2014-11-14 17:01 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 16258, Kenjiro NAKAYAMA

> This has now been tweaked slightly and bound globally to `M-s M-s'.

A binding in M-s, yes, but M-s M-s should be kept for a "very common
kind of search", and I'm not convinced "pass it to eww" is
common enough.


        Stefan





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2014-11-14 17:01   ` Stefan Monnier
@ 2014-11-15 19:26     ` Lars Magne Ingebrigtsen
  2014-11-17 14:05       ` Ted Zlatanov
  0 siblings, 1 reply; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-15 19:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16258, Kenjiro NAKAYAMA

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> This has now been tweaked slightly and bound globally to `M-s M-s'.
>
> A binding in M-s, yes, but M-s M-s should be kept for a "very common
> kind of search", and I'm not convinced "pass it to eww" is
> common enough.

Sure.  Uhm...  what would be a good mnemonic?  `M-s M-w' for "web"?  And
it's kinda easy to type.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
       [not found]           ` <15f0d58a-de8c-4aa7-b3f3-aa12662a8c58@default>
@ 2014-11-15 20:10             ` Drew Adams
       [not found]             ` <a88c0f55-68c4-4d5d-bdc7-a480c3aea5a2@default>
  1 sibling, 0 replies; 17+ messages in thread
From: Drew Adams @ 2014-11-15 20:10 UTC (permalink / raw)
  To: Stefan Monnier, Lars Magne Ingebrigtsen
  Cc: 16258, Kenjiro NAKAYAMA, emacs-devel

> it should not be named `*- region-search'.  It does not
> search the region (IIUC). It searches for the selected text.

Again, please rename the command.  The name is misleading.
The command neither searches the region nor searches for the
region (which would anyway be meaningless, from point).
It searches a buffer (I assume) for the text in the region.

People checking command names (via apropos commands or
completion matching, for example) looking for commands
that do something to the region can stumble on this.
(And people looking for a command that searches for the
selected text are unlikely to find it.)

A guess is that this was named by someone for whom
English is not the first language.  "Search X" is not
the same as "search for X".





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
       [not found]             ` <a88c0f55-68c4-4d5d-bdc7-a480c3aea5a2@default>
@ 2014-11-15 20:11               ` Lars Magne Ingebrigtsen
       [not found]               ` <m37fywb4vl.fsf@stories.gnus.org>
  1 sibling, 0 replies; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-15 20:11 UTC (permalink / raw)
  To: Drew Adams; +Cc: 16258, Kenjiro NAKAYAMA, emacs-devel

Drew Adams <drew.adams@oracle.com> writes:

>> it should not be named `*- region-search'.  It does not
>> search the region (IIUC). It searches for the selected text.
>
> Again, please rename the command.  The name is misleading.

It's not called that.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
       [not found]               ` <m37fywb4vl.fsf@stories.gnus.org>
@ 2014-11-15 20:18                 ` Drew Adams
  0 siblings, 0 replies; 17+ messages in thread
From: Drew Adams @ 2014-11-15 20:18 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 16258, Kenjiro NAKAYAMA

> >> it should not be named `*- region-search'.  It does not
> >> search the region (IIUC). It searches for the selected text.
> >
> > Again, please rename the command.  The name is misleading.
> 
> It's not called that.

Great.

(I just saw that this thread is cc'd to emacs-devel.  Why?)





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

* bug#16258: 24.3.50; [PATCH] eww: Add new function of region-search.
  2014-11-15 19:26     ` Lars Magne Ingebrigtsen
@ 2014-11-17 14:05       ` Ted Zlatanov
  0 siblings, 0 replies; 17+ messages in thread
From: Ted Zlatanov @ 2014-11-17 14:05 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 16258, Kenjiro NAKAYAMA

On Sat, 15 Nov 2014 20:26:56 +0100 Lars Magne Ingebrigtsen <larsi@gnus.org> wrote: 

LMI> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> This has now been tweaked slightly and bound globally to `M-s M-s'.
>> 
>> A binding in M-s, yes, but M-s M-s should be kept for a "very common
>> kind of search", and I'm not convinced "pass it to eww" is
>> common enough.

LMI> Sure.  Uhm...  what would be a good mnemonic?  `M-s M-w' for "web"?  And
LMI> it's kinda easy to type.

That's good IMO.

Ted





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

end of thread, other threads:[~2014-11-17 14:05 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-26  3:11 bug#16258: 24.3.50;[PATCH] eww: Add new function of region-search Kenjiro NAKAYAMA
2013-12-26 13:11 ` bug#16258: 24.3.50; [PATCH] " Kenjiro NAKAYAMA
2013-12-26 13:56 ` Lars Ingebrigtsen
2013-12-26 23:43   ` Kenjiro NAKAYAMA
2013-12-27  1:46     ` Lars Ingebrigtsen
2014-01-07 23:37       ` Ted Zlatanov
2014-11-10 21:41       ` Lars Magne Ingebrigtsen
     [not found]       ` <m3h9y6g2dd.fsf@stories.gnus.org>
2014-11-11  1:36         ` Stefan Monnier
     [not found]         ` <jwvfvdqeczj.fsf-monnier+emacsbugs@gnu.org>
2014-11-11  2:42           ` Drew Adams
     [not found]           ` <15f0d58a-de8c-4aa7-b3f3-aa12662a8c58@default>
2014-11-15 20:10             ` Drew Adams
     [not found]             ` <a88c0f55-68c4-4d5d-bdc7-a480c3aea5a2@default>
2014-11-15 20:11               ` Lars Magne Ingebrigtsen
     [not found]               ` <m37fywb4vl.fsf@stories.gnus.org>
2014-11-15 20:18                 ` Drew Adams
2014-11-14  3:47 ` Lars Magne Ingebrigtsen
2014-11-14  3:49   ` Lars Magne Ingebrigtsen
2014-11-14 17:01   ` Stefan Monnier
2014-11-15 19:26     ` Lars Magne Ingebrigtsen
2014-11-17 14:05       ` Ted Zlatanov

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).