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

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

[elpa] externals/hyperbole b53bfbe 6/6: hactypes.el - Fix Windows-compat


From: ELPA Syncer
Subject: [elpa] externals/hyperbole b53bfbe 6/6: hactypes.el - Fix Windows-compatibility when executing shell actions
Date: Wed, 21 Apr 2021 00:57:09 -0400 (EDT)

branch: externals/hyperbole
commit b53bfbe7be5b9699979281cc2e34faf38251c4ca
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    hactypes.el - Fix Windows-compatibility when executing shell actions
---
 Changes     |  7 +++++++
 hactypes.el | 29 +++++++++++++++--------------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/Changes b/Changes
index e09f292..11b9b4c 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+2021-04-21  Bob Weiner  <rsw@gnu.org>
+
+* hactypes.el (exec-shell-cmd, exec-window-cmd): Couple 'cd' and command
+    with '&&' rather than semicolon.  Also, expand default-directory to
+    eliminate '~' home dir refs.   Both of these for better Windows
+    compatibility.
+
 2021-04-20  Bob Weiner  <rsw@gnu.org>
 
 * Makefile (tests, all-tests): Add these target aliases.
diff --git a/hactypes.el b/hactypes.el
index 7fa53c3..1851b1c 100644
--- a/hactypes.el
+++ b/hactypes.el
@@ -102,8 +102,7 @@ error."
                                    (and (integerp repeat) (>= repeat 0))))
                              1))
      (list macro repeat)))
-  (if (called-interactively-p 'interactive)
-      nil
+  (unless (called-interactively-p 'interactive)
     (or (and kbd-macro (or (stringp kbd-macro)
                           (and (symbolp kbd-macro) (fboundp kbd-macro))))
        (hypb:error "(exec-kbd-macro): Bad macro: %s" kbd-macro))
@@ -130,18 +129,19 @@ kill the last output to the shell buffer before executing 
SHELL-CMD."
                             default2)))))
   (require 'comint)
   (let ((buf-name "*Hyperbole Shell*")
-       (obuf (current-buffer)))
+       (obuf (current-buffer))
+       (default-dir (expand-file-name default-directory)))
     (unwind-protect
        (progn
-         (if (not (hpath:remote-p default-directory))
-             (setq shell-cmd
-                   (concat "cd " default-directory "; " shell-cmd)))
+         (unless (hpath:remote-p default-dir)
+           (setq shell-cmd
+                 (concat "cd " default-dir " && " shell-cmd)))
          (if (and (get-buffer buf-name)
                   (get-buffer-process (get-buffer buf-name)))
              (hpath:display-buffer buf-name)
            ;; (hpath:display-buffer (current-buffer))
-           (if (eq (minibuffer-window) (selected-window))
-               (other-window 1))
+           (when (eq (minibuffer-window) (selected-window))
+             (other-window 1))
            ;; 'shell' calls pop-to-buffer which normally displays in
            ;; another window
            (setq buf-name (buffer-name (shell buf-name))))
@@ -169,12 +169,13 @@ kill the last output to the shell buffer before executing 
SHELL-CMD."
                       (lambda (cmd) (not (string-equal cmd "")))
                       default "Enter a shell command." 'string))))
   (require 'comint)
-  (let ((buf-name "*Hyperbole Shell*")
-       (cmd (if (hpath:remote-p default-directory)
-                (concat "(" shell-cmd ") &")
-              (concat "(cd " default-directory "; " shell-cmd ") &")))
-       (msg (format "Executing: %s" shell-cmd))
-       (shell-buf))
+  (let* ((buf-name "*Hyperbole Shell*")
+        (default-dir (expand-file-name default-directory))
+        (cmd (if (hpath:remote-p default-dir)
+                 (concat "(" shell-cmd ") &")
+               (concat "(cd " default-dir " && " shell-cmd ") &")))
+        (msg (format "Executing: %s" shell-cmd))
+        (shell-buf))
     (message msg)
     (save-excursion
       (save-window-excursion



reply via email to

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