From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Branham Newsgroups: gmane.emacs.bugs Subject: bug#27341: updated patch to fix docstring Date: Fri, 30 Jun 2017 08:25:58 +0200 Message-ID: <87bmp63sax.fsf@utexas.edu> References: <8760g1xxhw.fsf@utexas.edu> <8737b4grzq.fsf@utexas.edu> <8737aop2d9.fsf@users.sourceforge.net> <87lgoedf1t.fsf@utexas.edu> <87efu6nwa2.fsf@users.sourceforge.net> <878tkdy37e.fsf@utexas.edu> <874luymh1x.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1498804033 15798 195.159.176.226 (30 Jun 2017 06:27:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 30 Jun 2017 06:27:13 +0000 (UTC) User-Agent: mu4e 0.9.18; emacs 25.2.1 Cc: 27341@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 30 08:27:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQpOU-0003sv-JS for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Jun 2017 08:27:06 +0200 Original-Received: from localhost ([::1]:42732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQpOa-0006Jo-18 for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Jun 2017 02:27:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQpOU-0006JX-8I for bug-gnu-emacs@gnu.org; Fri, 30 Jun 2017 02:27:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQpOQ-0005AM-7q for bug-gnu-emacs@gnu.org; Fri, 30 Jun 2017 02:27:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42696) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQpOQ-00059w-1e for bug-gnu-emacs@gnu.org; Fri, 30 Jun 2017 02:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dQpOP-0005gQ-Mh for bug-gnu-emacs@gnu.org; Fri, 30 Jun 2017 02:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Branham Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Jun 2017 06:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27341 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 27341-submit@debbugs.gnu.org id=B27341.149880396921784 (code B ref 27341); Fri, 30 Jun 2017 06:27:01 +0000 Original-Received: (at 27341) by debbugs.gnu.org; 30 Jun 2017 06:26:09 +0000 Original-Received: from localhost ([127.0.0.1]:45373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQpNY-0005fI-LA for submit@debbugs.gnu.org; Fri, 30 Jun 2017 02:26:08 -0400 Original-Received: from mail-lf0-f53.google.com ([209.85.215.53]:35436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQpNX-0005f5-9B for 27341@debbugs.gnu.org; Fri, 30 Jun 2017 02:26:08 -0400 Original-Received: by mail-lf0-f53.google.com with SMTP id b207so64441899lfg.2 for <27341@debbugs.gnu.org>; Thu, 29 Jun 2017 23:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=utexas-edu.20150623.gappssmtp.com; s=20150623; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=fYdF7WEELhfxmrdiUqIQaTL36KIFJf9f9n7PcL0EyDo=; b=WWQhgyv9WqXiUFM4XqfCKu26i9sYNEbuT9JpgoteFSwe5EoGq/BtNFK+ps1kddtAs1 urQVnCIkD4O64o0tfsQObosXHTtgUq1JblXBSBAwx1hg9oSjOJd0z5sLm/id2sXPc/ps +HCjhobOWfjNXkB2+Urzt4k4lGbEGG1C5lgjTD4blfREoZE3TplEPkZY9awIwuptmW3u tUsB2W1nbk+aEH6q/iUpb/+AM/yGY2R6TshkAeTqaHHph+QIkEgn7jf6wlv/TLfrEYzP 99X4oyi7HR500LYjs1bGsU25hqsfJYwtJwPr8lpJJwLXHKWdKEasuIFMiqfLep+fN41p LuCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=fYdF7WEELhfxmrdiUqIQaTL36KIFJf9f9n7PcL0EyDo=; b=kHLBGAdUac9YPwRReGg9u8Y6vTEz1T83QPpXLN+4LghyVNMOkIBCwj8wt7Iv2jrBCN Ks2EnByd+Wr2P/YRV71wswiVjdcsntsXaKGnxV+UiFRtwNTjKEgvCaV8ggal/XLcE59P 1C/thuWZX0/70nHqSexMKiFx4SZkGZZ3Bx2jcCoQdZOZ6an3hLBXdLF9oLEducSjkdcr a4X/Kl4DYpgXw8DPAQPA8xycJaaIYn4i7QCssbfrnB00Ts6usPVBuBNFngr7VGwWqHEk d32lRHzu8tFRMO226rxQPHesquPQKTJF1cFt9KfPQI0+nSXHMQoCDNPEGM6gd4HkcYF6 D0Hg== X-Gm-Message-State: AIVw113NC9LhaqCl/gXbTg1ZkdxtYKJNjFgwQJfWwu2Alwz6Zj6dMejg 0MoZTQSeK0SD9XaOPlc= X-Received: by 10.25.216.82 with SMTP id p79mr70186lfg.35.1498803960997; Thu, 29 Jun 2017 23:26:00 -0700 (PDT) Original-Received: from mars (edu220107.eduroam.gu.se. [130.241.220.107]) by smtp.gmail.com with ESMTPSA id j12sm816784lfh.23.2017.06.29.23.25.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Jun 2017 23:25:59 -0700 (PDT) In-reply-to: <874luymh1x.fsf@users.sourceforge.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:134051 Archived-At: --=-=-= Content-Type: text/plain On Fri 30 Jun 2017 at 00:54, npostavs@users.sourceforge.net wrote: > Could you add a ChangeLog entry to the commit message as described in > CONTRIBUTE, please? Yes, I have done so. Let me know if it's not right. > >> (defun eww-search-words (&optional beg end) >> "Search the web for the text between BEG and END. >> -See the `eww-search-prefix' variable for the search engine used." >> + If region is active (and not whitespace), search the web for >> + the text between BEG and END. Else, prompt the user for a search >> + string. See the `eww-search-prefix' variable for the search >> + engine used." > > Doc strings shouldn't be indented like that, and there should be a > double space between sentences. Fixed. > >> (interactive "r") >> - (eww (buffer-substring beg end))) >> + (if (use-region-p) >> + (let ((region-string (buffer-substring beg end))) >> + (if (not (string-match-p "\\`[ \n\t\r\v\f]*\\'" region-string)) >> + (eww region-string))) >> + (eww (read-string "Query: ")))) > > This silently does nothing if the region is active but just blanks, did > you mean to fallback to querying in that case? Fixed, thanks --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0005-Make-eww-search-words-prompt-for-query-if-nothing-se.patch >From 1d036b16903dd18268c499c4617d430172b08ffe Mon Sep 17 00:00:00 2001 From: Alex Branham Date: Fri, 30 Jun 2017 08:16:13 +0200 Subject: [PATCH] Make eww-search-words prompt for query if nothing selected * lisp/net/eww.el (eww-search-words): Make eww-search-words prompt the user for a search query if the region is inactive or if the region is just whitespace. Copyright-paperwork-exempt: yes --- lisp/net/eww.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index fe31657914..757e738a18 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -314,9 +314,17 @@ word(s) will be searched for via `eww-search-prefix'." ;;;###autoload (defun eww-search-words (&optional beg end) "Search the web for the text between BEG and END. -See the `eww-search-prefix' variable for the search engine used." +If region is active (and not whitespace), search the web for +the text between BEG and END. Else, prompt the user for a search +string. See the `eww-search-prefix' variable for the search +engine used." (interactive "r") - (eww (buffer-substring beg end))) + (if (use-region-p) + (let ((region-string (buffer-substring beg end))) + (if (not (string-match-p "\\`[ \n\t\r\v\f]*\\'" region-string)) + (eww region-string) + (eww (read-string "Query: ")))) + (eww (read-string "Query: ")))) (defun eww-open-in-new-buffer () "Fetch link at point in a new EWW buffer." -- 2.13.2 --=-=-=--