From 02a806b9abbf5f7f17e6bdb90f17faba652a6f54 Mon Sep 17 00:00:00 2001 From: Dickby Date: Fri, 1 Jun 2018 23:37:04 +0000 Subject: Update feebleline.el --- feebleline.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/feebleline.el b/feebleline.el index e47e748..1d1ad19 100644 --- a/feebleline.el +++ b/feebleline.el @@ -159,7 +159,8 @@ sent to `add-text-properties'.") (setq window-divider-default-bottom-width 1 window-divider-default-places (quote bottom-only)) (window-divider-mode t) - (setq-default mode-line-format nil)) + (setq-default mode-line-format nil) + (setq mode-line-format nil)) (defun feebleline-legacy-settings-on () "Some default settings for EMACS < 25." @@ -186,8 +187,9 @@ sent to `add-text-properties'.") (add-hook 'focus-in-hook 'feebleline-mode-line-proxy-fn)) ;; Deactivation: - (set-face-attribute 'mode-line nil :height nil) - (setq-default 'mode-line-format feebleline/mode-line-format-previous) + (set-face-attribute 'mode-line nil :height 1.0) + (setq-default mode-line-format feebleline/mode-line-format-previous) + (setq mode-line-format feebleline/mode-line-format-previous) (cancel-timer feebleline/timer) (ad-deactivate 'handle-switch-frame) (remove-hook 'focus-in-hook 'feebleline-mode-line-proxy-fn) -- cgit v1.2.3 From ac3e7359f61208ba2b6837ba38e70d7fc7529ec6 Mon Sep 17 00:00:00 2001 From: Benjamin Lindqvist Date: Mon, 4 Jun 2018 14:08:42 +0200 Subject: removed ad-do-it advice that breaks under emacs 26.1 --- feebleline.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/feebleline.el b/feebleline.el index e47e748..ff9f2db 100644 --- a/feebleline.el +++ b/feebleline.el @@ -182,14 +182,14 @@ sent to `add-text-properties'.") (run-with-timer 0 0.5 'feebleline-mode-line-proxy-fn)) (if feebleline-use-legacy-settings (feebleline-legacy-settings-on) (feebleline-default-settings-on)) - (ad-activate 'handle-switch-frame) + ;; (ad-activate 'handle-switch-frame) (add-hook 'focus-in-hook 'feebleline-mode-line-proxy-fn)) ;; Deactivation: (set-face-attribute 'mode-line nil :height nil) (setq-default 'mode-line-format feebleline/mode-line-format-previous) (cancel-timer feebleline/timer) - (ad-deactivate 'handle-switch-frame) + ;; (ad-deactivate 'handle-switch-frame) (remove-hook 'focus-in-hook 'feebleline-mode-line-proxy-fn) (with-current-buffer " *Minibuf-0*" (erase-buffer)))) @@ -217,11 +217,11 @@ sent to `add-text-properties'.") (unless (current-message) (feebleline-write-buffer-name-maybe))) -(defadvice handle-switch-frame (after switch-frame-message-name) - "Get the modeline proxy to work with i3 switch focus." - (feebleline-write-buffer-name-maybe) - ad-do-it - (feebleline-write-buffer-name-maybe)) +;; (defadvice handle-switch-frame (after switch-frame-message-name) +;; "Get the modeline proxy to work with i3 switch focus." +;; (feebleline-write-buffer-name-maybe) +;; ad-do-it +;; (feebleline-write-buffer-name-maybe)) (provide 'feebleline) ;;; feebleline.el ends here -- cgit v1.2.3 From c0ae79454f6ea13825a4b1f813a0caa2fc352654 Mon Sep 17 00:00:00 2001 From: Dickby Date: Tue, 10 Jul 2018 17:32:50 +0000 Subject: redraw the modeline when feebleline is toggled off --- feebleline.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/feebleline.el b/feebleline.el index bc3c71c..5c6135f 100644 --- a/feebleline.el +++ b/feebleline.el @@ -193,6 +193,8 @@ sent to `add-text-properties'.") (cancel-timer feebleline/timer) ;; (ad-deactivate 'handle-switch-frame) (remove-hook 'focus-in-hook 'feebleline-mode-line-proxy-fn) + (force-mode-line-update) + (redraw-display) (with-current-buffer " *Minibuf-0*" (erase-buffer)))) -- cgit v1.2.3 From a8dc2089927beedd68440f8ccc7c688957e7db9f Mon Sep 17 00:00:00 2001 From: benjamin Date: Tue, 11 Sep 2018 21:28:44 +0200 Subject: Made it possible to not show linenum info in feebleline. Solves #22 --- feebleline.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/feebleline.el b/feebleline.el index bc3c71c..b9f6af2 100644 --- a/feebleline.el +++ b/feebleline.el @@ -97,6 +97,9 @@ (defcustom feebleline-show-directory t "Set this if you want to show the direcory path as well as the file-name in the modeline proxy." :group 'feebleline) +(defcustom feebleline-show-linenum t + "Set this if you want to show line number and column number in the modeline proxy." + :group 'feebleline) (defun feebleline-previous-buffer-name () "Get name of previous buffer." @@ -131,7 +134,10 @@ sent to `add-text-properties'.") '( ("%s" ((if feebleline-show-time (format-time-string "[%H:%M:%S] ") "")) (face feebleline-time-face)) - ("%6s" ((format "%s:%s" (format-mode-line "%l") (current-column))) + ("%s" + ((if feebleline-show-linenum + (format "%5s:%-2s" (format-mode-line "%l") (current-column)) + "")) (face feebleline-linum-face)) (" %s" ((if (and feebleline-show-directory (buffer-file-name)) (replace-regexp-in-string -- cgit v1.2.3 From 89ddf31ecad885e5491e8d6b71b48c1591b3faec Mon Sep 17 00:00:00 2001 From: benjamin Date: Fri, 14 Sep 2018 23:00:46 +0200 Subject: use magit's function to obtain git branch The old method was just incredibly hacky and bad. If magit is not installed, we still use the old method as fallback (but who doesn't use magit anyway) --- feebleline.el | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/feebleline.el b/feebleline.el index a62c77a..af4fff9 100644 --- a/feebleline.el +++ b/feebleline.el @@ -115,17 +115,28 @@ FORMAT-ARGS (a list) will be expanded as the rest of `format' arguments. If PROPS is given, it should be a list which will be sent to `add-text-properties'.") -(defun feebleline--git-branch-string () - "Return current git branch as a string, or the empty string if pwd is not in a git repo (or the git command is not found)." - (interactive) +(require 'magit nil t) +(if (fboundp 'magit-get-current-branch) + (defun feebleline--git-branch-string () + "Return current git branch as a string, or the empty string if pwd is not in a git repo (or the git command is not found)." + (interactive) + (require 'esh-ext) + (let ((git-output (magit-get-current-branch))) + (if (> (length git-output) 0) + git-output + "(no branch)"))) + + (message "Warning: Feebleline couldn't find magit! Using hacky version to obtain git branch.") (require 'esh-ext) - (when (and (eshell-search-path "git") - (locate-dominating-file default-directory ".git")) - (let ((git-output (shell-command-to-string (concat "cd " default-directory " && git branch | grep '\\*' | sed -e 's/^\\* //'")))) - (if (> (length git-output) 0) - (substring git-output 0 -1) - ;; (concat " :" (substring git-output 0 -1)) - "(no branch)")))) + (defun feebleline--git-branch-string () + "Return current git branch as a string, or the empty string if pwd is not in a git repo (or the git command is not found)." + (interactive) + (when (and (eshell-search-path "git") + (locate-dominating-file default-directory ".git")) + (let ((git-output (shell-command-to-string (concat "cd " default-directory " && git branch | grep '\\*' | sed -e 's/^\\* //'")))) + (if (> (length git-output) 0) + (substring git-output 0 -1) + "(no branch)"))))) (defvar feebleline--home-dir nil) -- cgit v1.2.3