Remove dependency on f.el
This commit is contained in:
parent
2c53218cc7
commit
89d2b7226b
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
;; Author: Lucien Cartier-Tilet <lucien@phundrak.com>
|
;; Author: Lucien Cartier-Tilet <lucien@phundrak.com>
|
||||||
;; Maintainer: Lucien Cartier-Tilet <lucien@phundrak.com>
|
;; Maintainer: Lucien Cartier-Tilet <lucien@phundrak.com>
|
||||||
;; Version: 0.8.4
|
;; Version: 0.8.5
|
||||||
;; Package-Requires: ((emacs "25.1") (f "0.20") (s "1"))
|
;; Package-Requires: ((emacs "25.1") (s "1"))
|
||||||
;; Homepage: https://github.com/Phundrak/eshell-info-banner.el
|
;; Homepage: https://github.com/Phundrak/eshell-info-banner.el
|
||||||
|
|
||||||
;; This file is not part of GNU Emacs
|
;; This file is not part of GNU Emacs
|
||||||
@ -60,6 +60,10 @@
|
|||||||
; Constants ;
|
; Constants ;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defconst eshell-info-banner-path-separator
|
||||||
|
(substring-no-properties (file-relative-name (expand-file-name "x" "y")) 1 2)
|
||||||
|
"File separator used by the current operating system.")
|
||||||
|
|
||||||
(defconst eshell-info-banner--min-length-left 8
|
(defconst eshell-info-banner--min-length-left 8
|
||||||
"Minimum length of text on the left hand side of the banner.")
|
"Minimum length of text on the left hand side of the banner.")
|
||||||
|
|
||||||
@ -308,21 +312,30 @@ For public use, PATH should be a string representing a UNIX path.
|
|||||||
For internal use, PATH can also be a list. If PATH is neither of
|
For internal use, PATH can also be a list. If PATH is neither of
|
||||||
these, an error will be thrown by the function."
|
these, an error will be thrown by the function."
|
||||||
(cond
|
(cond
|
||||||
((stringp path) (abbreviate-file-name
|
((stringp path)
|
||||||
(if abbr
|
(let ((abbr-path (abbreviate-file-name path)))
|
||||||
(eshell-info-banner--abbr-path
|
(if abbr
|
||||||
(f-split (eshell-info-banner--abbr-path path)))
|
(abbreviate-file-name
|
||||||
path)))
|
(eshell-info-banner--abbr-path
|
||||||
|
(split-string abbr-path eshell-info-banner-path-separator t)))
|
||||||
|
abbr-path)))
|
||||||
((null path) "")
|
((null path) "")
|
||||||
((listp path)
|
((listp path)
|
||||||
(f-join (if (= (length path) 1)
|
(let ((file (eshell-info-banner--abbr-path (cdr path)))
|
||||||
(car path)
|
(directory (if (= (length path) 1)
|
||||||
(let* ((dir (car path))
|
(car path)
|
||||||
(first-char (substring dir 0 1)))
|
(let* ((dir (car path))
|
||||||
(if (string= "." first-char)
|
(first-char (substring dir 0 1)))
|
||||||
(substring dir 0 2)
|
(if (string= "." first-char)
|
||||||
first-char)))
|
(substring dir 0 2)
|
||||||
(eshell-info-banner--abbr-path (cdr path))))
|
first-char)))))
|
||||||
|
(if (string= "" file)
|
||||||
|
directory
|
||||||
|
(let ((relative-p (not (file-name-absolute-p directory)))
|
||||||
|
(new-dir (expand-file-name file directory)))
|
||||||
|
(if relative-p
|
||||||
|
(file-relative-name new-dir)
|
||||||
|
new-dir)))))
|
||||||
(t (error "Invalid argument %s, neither stringp or listp" path))))
|
(t (error "Invalid argument %s, neither stringp or listp" path))))
|
||||||
|
|
||||||
(defun eshell-info-banner--get-mounted-partitions-duf ()
|
(defun eshell-info-banner--get-mounted-partitions-duf ()
|
||||||
|
Loading…
Reference in New Issue
Block a user