emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] scratch/hyperbole-merge-7.0.2b b02bf71 19/23: Merge branch 'maste


From: Stefan Monnier
Subject: [elpa] scratch/hyperbole-merge-7.0.2b b02bf71 19/23: Merge branch 'master' of git.sv.gnu.org:/srv/git/hyperbole with changes
Date: Tue, 5 Feb 2019 16:11:21 -0500 (EST)

branch: scratch/hyperbole-merge-7.0.2b
commit b02bf71a2b271e8920d38e281ac559c85c81bca1
Merge: f3d59c4 450489e
Author: Bob Weiner <address@hidden>
Commit: Bob Weiner <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/hyperbole with changes
---
 Changes         | 11 +++++++++++
 hpath.el        | 13 +++++++++----
 hsettings.el    | 18 ++++++++++++++++--
 hsys-org.el     | 26 ++++++++++++++++++++------
 hui-treemacs.el | 20 +++++++++++---------
 5 files changed, 67 insertions(+), 21 deletions(-)

diff --git a/Changes b/Changes
index 52e541c..8b13892 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,17 @@
 
 * hversion.el: Pushed BW changes for 7.0.2b test update.
 
+* hui-treemacs.el (treemacs-quit): Defined if treemacs doesn't and used.
+
+2019-02-03  Mats Lidell  <address@hidden>
+
+* hui-treemacs.el (treemacs-version): Require v2 or higher.
+
+* hsettings.el (hyperbole-default-web-search-term-max-lines): 
+               (hyperbole-default-web-search-term): Added.
+
+* hpath.el (hpath:tramp-file-name-regexp): Added and used in hpath:remote-at-p.
+
 2019-02-02  Bob Weiner  <address@hidden>
 
 * hsys-org.el (org-mode): Support derived modes too.
diff --git a/hpath.el b/hpath.el
index c460e3f..2eebd1f 100644
--- a/hpath.el
+++ b/hpath.el
@@ -536,6 +536,14 @@ directories.  The first one in which PATH is found is 
used."
          (or (file-exists-p rtn) (setq rtn nil)))
        (or rtn path)))))
 
+(defun hpath:tramp-file-name-regexp ()
+  "Returns a modified tramp-file-name-regexp for matching to the beginning of 
a remote file name.
+Removes bol anchor and removes match to empty string if present."
+  (let ((tramp-regexp (car (if (fboundp 'tramp-file-name-structure)
+                              (tramp-file-name-structure)
+                            tramp-file-name-structure))))
+    (substring-no-properties (replace-regexp-in-string "\\\\'" "" 
tramp-regexp) 1)))
+
 (defun hpath:remote-at-p ()
   "Returns a remote pathname that point is within or nil.
 See the `(emacs)Remote Files' info documentation for pathname format details.
@@ -549,10 +557,7 @@ Always returns nil if (hpath:remote-available-p) returns 
nil."
              (skip-chars-backward "^[ \t\n\r\f\"`'|\(\{<")
              (cond
               ((and (eq remote-package 'tramp)
-                    ;; Remove match to bol in this regexp before testing.
-                    (looking-at (substring-no-properties (car (if (fboundp 
'tramp-file-name-structure)
-                                                                  
(tramp-file-name-structure)
-                                                                
tramp-file-name-structure)) 1)))
+                    (looking-at (hpath:tramp-file-name-regexp)))
                (match-string-no-properties 0))
               ((looking-at hpath:url-regexp)
                (if (string-equal (match-string-no-properties 
hpath:protocol-grpn) "ftp")
diff --git a/hsettings.el b/hsettings.el
index 809dd31..6cdd1b8 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.
@@ -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)
diff --git a/hsys-org.el b/hsys-org.el
index 1ad9a9e..1056d24 100644
--- a/hsys-org.el
+++ b/hsys-org.el
@@ -4,16 +4,17 @@
 ;;
 ;; Orig-Date:     2-Jul-16 at 14:54:14
 ;;
-;; Copyright (C) 2016  Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
 ;;
 ;; This file is part of GNU Hyperbole.
 
 ;;; Commentary:
 ;;
-;;   This defines a context-sensitive implicit button type, org-mode, triggered
-;;   when the major mode is org-mode and point is anywhere other than
-;;   the end of a line.
+;;   This defines a context-sensitive implicit button type, org-mode,
+;;   triggered when the major mode is org-mode or is derived from
+;;   org-mode and point is anywhere other than at the end of a line.
+;;
 ;;   When:
 ;;     on an Org mode link - displays the link referent
 ;;     on an Org mode heading - cycles through the available display
@@ -28,6 +29,18 @@
 (require 'hbut)
 (require 'org)
 
+(defun hsys-org-cycle ()
+  "Calls org-cycle and forces it to be set as this-command to cycle through 
all states."
+  (setq last-command 'org-cycle
+       this-command 'org-cycle)
+  (org-cycle))
+
+(defun hsys-org-global-cycle ()
+  "Calls org-global-cycle and forces it to be set as this-command to cycle 
through all states."
+  (setq last-command 'org-cycle
+       this-command 'org-cycle)
+  (org-global-cycle nil))
+
 ;;; ************************************************************************
 ;;; Public Button Types
 ;;; ************************************************************************
@@ -41,7 +54,7 @@ and `browse-url-generic'."
     (cond ((org-link-at-p)
           (hact 'org-link nil))
          ((org-at-heading-p)
-          (hact 'org-cycle nil))
+          (hact 'hsys-org-cycle))
          (t (hact 'org-meta-return)))))
 
 (defun org-mode:help (&optional _but)
@@ -52,7 +65,7 @@ If on an Org mode link, displays standard Hyperbole help."
           (hkey-help current-prefix-arg)
           t)
          ((org-at-heading-p)
-          (org-global-cycle nil)
+          (hact 'hsys-org-global-cycle)
           t))))
 
 (defact org-link (link)
@@ -67,6 +80,7 @@ If on an Org mode link, displays standard Hyperbole help."
 
 ;; Assumes caller has already checked that the current buffer is in org-mode.
 (defun org-link-at-p ()
+  "Returns non-nil iff point is on an Org mode link."
   (let ((face-prop (get-text-property (point) 'face)))
     (or (eq face-prop 'org-link)
        (and (listp face-prop) (memq 'org-link face-prop)))))
diff --git a/hui-treemacs.el b/hui-treemacs.el
index db1aee6..d653645 100644
--- a/hui-treemacs.el
+++ b/hui-treemacs.el
@@ -4,7 +4,7 @@
 ;;
 ;; Orig-Date:    19-Nov-17
 ;;
-;; Copyright (C) 2017  Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
 ;;
 ;; This file is part of GNU Hyperbole.
@@ -18,14 +18,16 @@
 
 (eval-and-compile (require 'treemacs nil t))
 
-(eval-when (load)
-  (unless (>= (string-to-number treemacs-version) 1.14)
-    (error "(hui-treemacs): Hyperbole requires Treemacs package version 1.14 
or greater")))
+(unless (string-greaterp treemacs-version "v2")
+  (error "(hui-treemacs): Hyperbole requires Treemacs package version 2.0 or 
greater"))
 
 ;;; ************************************************************************
 ;;; smart-treemacs functions
 ;;; ************************************************************************
 
+(unless (fboundp 'treemacs-quit)
+  (fset 'treemacs-quit #'bury-buffer))
+
 ;;;###autoload
 (defun smart-treemacs ()
   "Uses a single key or mouse key to manipulate directory entries.
@@ -51,10 +53,10 @@ If key is pressed:
   (interactive)
   (cond ((first-line-p)
         (if (eolp)
-            (treemacs-toggle)
+            (treemacs-quit)
           (hact 'link-to-directory default-directory)))
        ((and (last-line-p) (eolp))
-        (treemacs-toggle))
+        (treemacs-quit))
        ((eolp)
         (funcall (if assist-flag assist-key-eol-function 
action-key-eol-function)))
        (t (let ((over-icon (and (treemacs-current-button)
@@ -65,7 +67,7 @@ If key is pressed:
                     (hact 'link-to-buffer-tmp (seq-elt result 0) (seq-elt 
result 1))
                   ;; (bufferp result)
                   (hact 'link-to-buffer-tmp result))
-              (treemacs-push-button current-prefix-arg))))))
+              (treemacs-toggle-node current-prefix-arg))))))
 
 ;;;###autoload
 (defun smart-treemacs-modeline ()
@@ -86,7 +88,7 @@ Suitable for use as a value of 
`action-key-modeline-buffer-id-function'."
              (treemacs-is-treemacs-window? action-key-depress-window)
            (string-match " Treemacs " (format-mode-line mode-line-format)))
          ;; Quit/hide treemacs.
-         (treemacs-toggle))
+         (treemacs-quit))
         ;;
         ;; Treemacs is visible and displaying the same dir as
         ;; the default dir of the clicked on modeline.
@@ -95,7 +97,7 @@ Suitable for use as a value of 
`action-key-modeline-buffer-id-function'."
                             (with-current-buffer (treemacs-buffer-exists?)
                               default-directory)))
          ;; Quit/hide treemacs.
-         (treemacs-toggle))
+         (treemacs-quit))
         ;;
         ;; Otherwise, invoke treemacs on the default dir of the clicked on 
modeline.
         (t (treemacs))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]