Skip to content

Commit

Permalink
Add tramp check
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Nov 23, 2023
1 parent e3b0100 commit 7b6c57f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mbs.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
;; Author: Shen, Jen-Chieh <[email protected]>
;; URL: https://github.com/jcs-elpa/mbs
;; Version: 0.1.0
;; Package-Requires: ((emacs "26.1"))
;; Package-Requires: ((emacs "26.1") (s "1.12.0"))
;; Keywords: convenience minibuffer stats

;; This file is NOT part of GNU Emacs.
Expand All @@ -31,6 +31,8 @@

;;; Code:

(require 's)

(defmacro mbs--with-minibuffer-env (&rest body)
"Execute BODY with minibuffer variables."
(declare (indent 0) (debug t))
Expand Down Expand Up @@ -58,5 +60,13 @@
(mbs--with-minibuffer-env
(string-prefix-p "New name:" prompt)))

;;;###autoload
(defun mbs-tramp-p ()
"Return non-nil if current minibuffer connect over tramp."
(mbs--with-minibuffer-env
(and (mbs-finding-file-p)
(s-contains-p ":" contents)
(string-prefix-p "/" contents))))

(provide 'mbs)
;;; mbs.el ends here

0 comments on commit 7b6c57f

Please sign in to comment.