10sr пре 3 година
родитељ
комит
3087bf2cdd
Signed by: 10sr GPG Key ID: 7BEC428194130EB2
1 измењених фајлова са 32 додато и 3 уклоњено
  1. +32
    -3
      emacs.el

+ 32
- 3
emacs.el Прегледај датотеку

@@ -856,11 +856,42 @@ THEM are function and its args."
(defvar helm-map)
(define-key helm-map (kbd "C-h") (kbd "DEL")))

(defun my-shrink-path-width (path width)
"Shrink PATH to be same or shorter than WIDTH."
(setq path (abbreviate-file-name path))
(if (file-remote-p path)
(let* ((remote (file-remote-p path))
(localname (file-remote-p path 'localname))

(remote-length (length remote))
(width-localname (- width remote-length))

(localname-shrinked (my-shrink-path-width localname width-localname)))
(concat remote localname-shrinked))
(let ((yet (split-string path "/"))
(done nil)
(result path))
(while (and yet
(< width (length result)))
(let ((current (pop yet)))
(unless (string= "" current)
(setq current (substring current 0 1)))
(setq done
(append done (list current))))
(setq result
(concat (mapconcat 'identity
(append done yet)
"/"))))
result)))
;; (my-shrink-path-width "/Applications/Vivaldi.app/Contents/MacOS/Vivaldi" 20)
;; (my-shrink-path-width "/scp:sakura:/Applications/Vivaldi.app/Contents/MacOS/Vivaldi" 30)
;; (my-shrink-path-width "/scp:sakura:/Applications/Vivaldi.app/Contents/MacOS/Vivaldi" 20)

(setq-default header-line-format
'(:eval (let ((f (or (buffer-file-name)
default-directory)))
(when f
(abbreviate-file-name f)))))
(my-shrink-path-width f (window-width))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; letters, font-lock mode and fonts
@@ -3070,8 +3101,6 @@ ARGS are not used."
"/Applications/Vivaldi.app/Contents/MacOS/Vivaldi"
url))



;; https://emacs-jp.github.io/tips/startup-optimization
;; Restore to original value
(setq gc-cons-threshold my-orig-gc-cons-threshold)


Loading…
Откажи
Сачувај