summaryrefslogtreecommitdiff
path: root/hsettings.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-08-14 04:29:57 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-08-14 04:29:57 -0400
commit6e555e763567c66ad8e50724a7dd5e286dbb1e65 (patch)
tree86fb29daa274d8007063babec826719154bf087e /hsettings.el
parent98a5ecb3bf80f2b53523c769459d1a1a49491125 (diff)
parent332ef336a7ad87e25c0563bfeaf0e6758d52c59c (diff)
Merge remote-tracking branch 'hyperbole/master' into externals/hyperbolescratch/hyperbole-lexbind
Diffstat (limited to 'hsettings.el')
-rw-r--r--hsettings.el65
1 files changed, 37 insertions, 28 deletions
diff --git a/hsettings.el b/hsettings.el
index 1935242..0f4ca10 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-2019 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
;;
;; This file is part of GNU Hyperbole.
@@ -34,7 +34,7 @@
;; The following section applies only to MS-DOS and MS-Windows OSs.
;; Users of other OSs may simply ignore this section.
-;; Some versions of Microcruft OSs don't automatically set the
+;; Some versions of Microsoft OSs don't automatically set the
;; timezone so that Hyperbole can read it. Nor do they include a
;; UNIX-style date program. So follow the commented instructions in
;; the code below here.
@@ -43,7 +43,7 @@
;; timezone properly and you need not do anything. If you receive a
;; timezone error, simply follow the instructions below to set the
;; timezone manually and then reload Hyperbole.
-(if (and hyperb:microcruft-os-p
+(if (and hyperb:microsoft-os-p
(require 'htz)
(not (stringp htz:local)))
(progn
@@ -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 ()
+ "Return a default search term if region is active and not too large."
+ (and (region-active-p)
+ (<= (count-lines (region-beginning) (region-end)) hyperbole-default-web-search-term-max-lines)
+ (buffer-substring-no-properties (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)
@@ -149,6 +163,24 @@ package to display search results."
search-term)))
(user-error "(Hyperbole): Invalid web search service `%s'" service-name))))
+(defcustom inhibit-hyperbole-messaging t
+ "*Determines whether Hyperbole supports explicit buttons in mail and news buffers.
+The default of t means disable such support (work remains to
+modernize these features). When t, Hyperbole will not alter
+messaging mode hooks nor overload functions from these packages,
+preventing potential incompatibilities.
+
+If you want to use Hyperbole buttons in mail and news buffers, set
+this variable to nil by adding (hyperbole-toggle-messaging 1)
+to your personal Emacs initialization file, prior to loading
+Hyperbole, and then restart Emacs."
+ :type 'boolean
+ :initialize 'custom-initialize-set
+ :set (lambda (symbol value)
+ ;; Invert value to produce ARG for hyperbole-toggle-messaging.
+ (hyperbole-toggle-messaging (if value 0 1)))
+ :group 'hyperbole-buttons)
+
(defcustom hyperbole-web-search-browser-function browse-url-browser-function
"*Function of one url argument called by any Hyperbole Find/Web search."
:type 'boolean
@@ -191,7 +223,7 @@ obtained search string."
;; No-op unless set by one of the conditionals below.
(defun hui:but-flash ())
-(cond ((and (not (featurep 'xemacs)) (not noninteractive))
+(cond ((not noninteractive)
(require 'hui-em-but)
;; Highlight explicit buttons whenever a file is read in.
(add-hook 'find-file-hook #'hproperty:but-create t)
@@ -211,29 +243,6 @@ obtained search string."
;;
;; If you find that the Hyperbole button flash time is too slow
;; or too fast, adjust it here.
- (setq hproperty:but-flash-time 1000))
-
- ((and (featurep 'xemacs) (not noninteractive))
- (require 'hui-xe-but)
- ;;
- ;; Highlight explicit buttons when files are read in.
- (add-hook 'find-file-hook #'hproperty:but-create t)
- (defalias 'hui:but-flash 'hproperty:but-flash)
- ;;
- ;; Substitute for the nil argument below a valid X color name with
- ;; which to highlight buttons if the default highlighting does not
- ;; appeal to you. See "hui-xe-but.el" for how this works.
- (hproperty:cycle-but-color nil)
- ;;
- ;; Non-nil means highlight all explict buttons with `hproperty:but-face'.
- (setq hproperty:but-highlight-flag t)
- ;;
- ;; Non-nil means visually emphasize that button under mouse cursor is
- ;; selectable.
- (setq hproperty:but-emphasize-p nil)
- ;;
- ;; If you find that the Hyperbole button flash time is too slow
- ;; or too fast, adjust it here.
(setq hproperty:but-flash-time 1000)))
;;; ************************************************************************