[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/hyperbole-merge-7.0.2b 45a0841 12/23: Add default search
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/hyperbole-merge-7.0.2b 45a0841 12/23: Add default search term for web searches |
Date: |
Tue, 5 Feb 2019 16:11:20 -0500 (EST) |
branch: scratch/hyperbole-merge-7.0.2b
commit 45a08418c3b2b1568a531998b606c442452e641f
Author: Mats Lidell <address@hidden>
Commit: Mats Lidell <address@hidden>
Add default search term for web searches
When region is active and not to big the selected text is used as a
default search term. This make it convenient to mark text and use that
for different types of web searches.
---
hsettings.el | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/hsettings.el b/hsettings.el
index d3c37f5..48ade5c 100644
--- a/hsettings.el
+++ b/hsettings.el
@@ -4,7 +4,7 @@
;;
;; Orig-Date: 15-Apr-91 at 00:48:49
;;
-;; Copyright (C) 1991-2017 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2018 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
;;
;; This file is part of GNU Hyperbole.
@@ -123,6 +123,19 @@ down a windowful."
(hyperbole-menubar-menu)
(hyperbole-minibuffer-menu))
+(defcustom hyperbole-default-web-search-term-max-lines 2
+ "Provide a default search term using the selected text if the
+active region contains less than or equal to this number of
+lines"
+ :type 'integer
+ :group 'hyperbole-commands)
+
+(defun hyperbole-default-web-search-term ()
+ "Fetch a default search term if region is active and not to big"
+ (and (region-active-p)
+ (<= (count-lines (region-beginning) (region-end))
hyperbole-default-web-search-term-max-lines)
+ (buffer-substring (region-beginning) (region-end))))
+
(defun hyperbole-read-web-search-arguments (&optional service-name search-term)
"Read from the keyboard a list of (web-search-service-string
search-term-string) if not given as arguments."
(let ((completion-ignore-case t))
@@ -130,7 +143,8 @@ down a windowful."
(setq service-name (completing-read "Search service: "
hyperbole-web-search-alist
nil t)))
(while (or (not (stringp search-term)) (equal search-term ""))
- (setq search-term (read-string (format "Search %s for: " service-name))))
+ (setq search-term (read-string (format "Search %s for: " service-name)
+ (hyperbole-default-web-search-term))))
(list service-name search-term)))
(defun hyperbole-web-search (&optional service-name search-term)
- [elpa] branch scratch/hyperbole-merge-7.0.2b created (now c75213b), Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b e803881 01/23: Fixed a cyclic Lisp library require; improved multi-frame hkey-throw, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b b7beb76 02/23: Fixed hkey-throw temporary display of a buffer in a new frame, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 7efe2f2 03/23: Removed Koutliner use of filladapt mode; it can cause filling errors, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 30600eb 04/23: Added extensive gitlab-reference ibtype; improved github-reference, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 1568adb 07/23: Merge Mats TEXINFO_SRC Makefile changes, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b ad584fd 11/23: Use implicit button org-mode also for org derived modes, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b f446ee0 22/23: Fixed README.md typo that referred to HY-ABOUT instead of HY-NEWS., Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 45a0841 12/23: Add default search term for web searches,
Stefan Monnier <=
- [elpa] scratch/hyperbole-merge-7.0.2b d4653c5 10/23: Require 2.0 of treemacs and use bury-buffer, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b c0bd503 05/23: Rebuild doc when doc sources have changed, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 5892083 09/23: Use new treemacs 1.18 function treemacs-toggle-node, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 450489e 13/23: Adjust tramp-file-name-regexp to work with looking-at, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 2e878cb 16/23: Initial commit of Windows path handling, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b d729726 21/23: Merge branch 'master' of github.com:rswgnu/hyperbole, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 66106d3 08/23: Fixed issue with inhibit-hyperbole-messaging not be set properly, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b afe3db8 06/23: Added 'k' to klink ids exported to html;, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 09e646e 17/23: Add implicit path button support for MSWindows paths, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b b02bf71 19/23: Merge branch 'master' of git.sv.gnu.org:/srv/git/hyperbole with changes, Stefan Monnier, 2019/02/05