Merge remote-tracking branch 'origin/master'
commit
c2d2aec81e
|
@ -150,13 +150,20 @@
|
|||
|
||||
(defun eshell-or-new-session (&optional arg)
|
||||
"Create an interactive Eshell buffer.
|
||||
If there is already an Eshell session active, switch to it.
|
||||
If current buffer is already an Eshell buffer, create a new one and switch to it.
|
||||
Switch to last Eshell session if any.
|
||||
Otherwise create a new one and switch to it.
|
||||
See `eshell' for the numeric prefix ARG."
|
||||
(interactive "P")
|
||||
(if (eq major-mode 'eshell-mode)
|
||||
(if (or arg (eq major-mode 'eshell-mode))
|
||||
(eshell (or arg t))
|
||||
(eshell arg)))
|
||||
(let ((last (buffer-list)))
|
||||
(while (and last
|
||||
(not (with-current-buffer (car last)
|
||||
(eq major-mode 'eshell-mode))))
|
||||
(setq last (cdr last)))
|
||||
(if last
|
||||
(switch-to-buffer (car last))
|
||||
(eshell (or arg t))))))
|
||||
|
||||
;;; REVIEW: Emacs' standard functions fail when output has empty lines.
|
||||
;;; This implementation is more reliable.
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
"<escape>" 'helm-keyboard-quit)
|
||||
|
||||
(evil-define-key 'normal helm-map
|
||||
"h" 'helm-next-source
|
||||
"j" 'helm-next-line
|
||||
"k" 'helm-previous-line
|
||||
"l" 'helm-execute-persistent-action
|
||||
"g" 'helm-beginning-of-buffer
|
||||
"G" 'helm-end-of-buffer
|
||||
(kbd "C-f") 'helm-next-page
|
||||
|
@ -38,9 +42,13 @@
|
|||
"C-/" 'helm-ff-run-find-sh-command
|
||||
"M-h" 'helm-find-files-up-one-level
|
||||
"M-l" 'helm-execute-persistent-action
|
||||
"C-l" nil)) ; So the header displays the above binding.
|
||||
"C-l" nil) ; So the header displays the above binding.
|
||||
(evil-define-key 'normal map
|
||||
"h" 'helm-find-files-up-one-level
|
||||
"l" 'helm-execute-persistent-action))
|
||||
|
||||
(with-eval-after-load 'init-exwm
|
||||
(define-keys exwm/helm-browser-map "M-d" 'helm-buffer-run-kill-persistent)
|
||||
(define-keys exwm/helm-browser-map "M-o" 'helm-buffer-switch-other-window))
|
||||
|
||||
(provide 'init-evil-helm)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
(evil-leader/set-key
|
||||
"p" 'emms-pause
|
||||
"n" 'emms-next))
|
||||
|
||||
(with-eval-after-load 'init-helm
|
||||
(evil-leader/set-key
|
||||
"b" 'helm-mini
|
||||
|
|
|
@ -6,29 +6,55 @@
|
|||
|
||||
;;; TODO: Do not depend on MELPA org but org-plus-contrib.
|
||||
|
||||
;;; TODO: J is shadowed. Also set calendar movements.
|
||||
;;; See https://github.com/Somelauw/evil-org-mode/issues/15.
|
||||
|
||||
;; (evil-define-key 'normal org-mode-map
|
||||
;; (kbd "M-<return>") (lambda () (interactive) (evil-insert 1) (org-meta-return))
|
||||
;; "H" 'org-shiftleft
|
||||
;; "J" 'org-shiftdown
|
||||
;; "K" 'org-shiftup
|
||||
;; "L" 'org-shiftright
|
||||
;; (kbd "M-h") 'org-metaleft
|
||||
;; (kbd "M-j") 'org-metadown
|
||||
;; (kbd "M-k") 'org-metaup
|
||||
;; (kbd "M-l") 'org-metaright
|
||||
;; (kbd "M-H") 'org-shiftmetaleft
|
||||
;; (kbd "M-J") 'org-shiftmetadown
|
||||
;; (kbd "M-K") 'org-shiftmetaup
|
||||
;; (kbd "M-L") 'org-shiftmetaright
|
||||
;; "<" 'org-up-element)
|
||||
|
||||
(when (require 'evil-org nil t)
|
||||
(add-hook 'org-mode-hook 'evil-org-mode)
|
||||
(evil-org-set-key-theme '(navigation insert textobjects additional))) ; shift? (shadows J) rsi todo heading
|
||||
;; No need for 'rsi, 'insert, 'shift (I use custom definition), 'todo 'heading.
|
||||
(evil-org-set-key-theme '(navigation textobjects additional)))
|
||||
|
||||
;;; REVIEW: Report upstream: https://github.com/Somelauw/evil-org-mode/issues/25.
|
||||
(defun evil-org-meta-return ()
|
||||
"Like `org-meta-return' but switch to insert mode."
|
||||
(interactive)
|
||||
(evil-insert 1)
|
||||
(org-meta-return))
|
||||
|
||||
(defun evil-org-shiftleft ()
|
||||
(interactive)
|
||||
;; TODO: Use `org-at-heading-or-item-p' instead?
|
||||
(if (org-on-heading-p)
|
||||
(org-shiftleft)
|
||||
(evil-window-top)))
|
||||
|
||||
(defun evil-org-shiftright ()
|
||||
(interactive)
|
||||
(if (org-on-heading-p)
|
||||
(org-shiftright)
|
||||
(evil-window-bottom)))
|
||||
|
||||
(defun evil-org-shiftup ()
|
||||
(interactive)
|
||||
(if (org-on-heading-p)
|
||||
(org-shiftup)
|
||||
(evil-lookup)))
|
||||
|
||||
(defun evil-org-shiftdown ()
|
||||
(interactive)
|
||||
(if (org-on-heading-p)
|
||||
(org-shiftdown)
|
||||
(call-interactively 'evil-join)))
|
||||
|
||||
(evil-define-key 'normal evil-org-mode-map
|
||||
"H" 'evil-org-shiftleft
|
||||
"J" 'evil-org-shiftdown
|
||||
"K" 'evil-org-shiftup
|
||||
"L" 'evil-org-shiftright
|
||||
"^" 'org-up-element ; Evil-Magit-inspired. TODO: Suggest upstream.
|
||||
"<" 'org-up-element ; Custom
|
||||
">" 'org-down-element ; Custom
|
||||
(kbd "M-<return>") 'evil-org-meta-return)
|
||||
|
||||
;;; TODO: Set org-agenda bindings
|
||||
;;; See https://github.com/Somelauw/evil-org-mode/issues/15.
|
||||
(defun evil-org-agenda-todo ()
|
||||
(interactive)
|
||||
(org-agenda-todo t))
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
;;; TODO: Pressing "s-a" ('emms-smart-browse) loses the cursor.
|
||||
;;; Sometimes waiting helps. Calling emms-smart-browse manually does not trigger the issue.
|
||||
;;; TODO: Spawn select programs in floating mode. (E.g. mpv, mupen64plus, mplayer, qemu, steam, .exe (wine).)
|
||||
;;; TODO: Spawn select programs in floating mode? (E.g. mpv, mupen64plus, mplayer, qemu, steam, .exe (wine).)
|
||||
;;; TODO: Separate EXWM buffers and Emacs buffers in `helm-mini'?
|
||||
|
||||
;;; TODO: Rendering issue with Qutebrowser
|
||||
|
@ -98,46 +98,71 @@
|
|||
|
||||
;;; Web browser
|
||||
(with-eval-after-load 'helm
|
||||
;; TODO: Post on EXWM's wiki once all TODOs are fixed.
|
||||
;; Publish on MELPA? Maybe with generic code for EXWM buffers with column
|
||||
;; containing the class name, and and emacs-buffers helm source too.
|
||||
;; REVIEW: When follow-mode is on, multiselection is broken.
|
||||
;; TODO: s-w s-w loses focus.
|
||||
;; TODO: kill-persistent is not persistent.
|
||||
(defvar exwm/helm-browser-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map helm-map)
|
||||
(define-key map (kbd "C-c o") 'helm-buffer-switch-other-window)
|
||||
(define-key map (kbd "C-c C-o") 'helm-buffer-switch-other-frame)
|
||||
(define-key map (kbd "M-D") 'helm-buffer-run-kill-buffers)
|
||||
(define-key map (kbd "C-c d") 'helm-buffer-run-kill-persistent)
|
||||
;; (define-key map (kbd "C-c d") 'exwm/helm-browsers-run-kill-persistent)
|
||||
map)
|
||||
"Keymap for browser source in Helm.")
|
||||
|
||||
(defun exwm/helm-update ()
|
||||
(message "EXWM/HELM"))
|
||||
|
||||
(defun exwm/helm-browser-buffers ()
|
||||
"Preconfigured `helm' to list browser buffers."
|
||||
(interactive)
|
||||
(helm :sources
|
||||
(helm-build-sync-source (concat (or exwm-class-name (file-name-nondirectory browse-url-generic-program)) " buffers")
|
||||
:candidates
|
||||
(delq nil (mapcar
|
||||
(lambda (buf)
|
||||
(if (with-current-buffer buf
|
||||
(and (eq major-mode 'exwm-mode)
|
||||
(string= (downcase exwm-class-name) (file-name-nondirectory browse-url-generic-program))))
|
||||
(buffer-name buf)
|
||||
nil))
|
||||
(buffer-list)))
|
||||
(let (
|
||||
(bufs (delq nil (mapcar
|
||||
(lambda (buf)
|
||||
(if (with-current-buffer buf
|
||||
(and (eq major-mode 'exwm-mode)
|
||||
(string= (downcase exwm-class-name) (file-name-nondirectory browse-url-generic-program))))
|
||||
(buffer-name buf)
|
||||
nil))
|
||||
(buffer-list)))))
|
||||
(when bufs
|
||||
;; Move first buffer (current) to last position.
|
||||
(setcdr (last bufs) (list (pop bufs))))
|
||||
bufs)
|
||||
:action '(("Switch to browser buffer(s)" . helm-buffer-switch-buffers)
|
||||
("Switch to browser buffer(s) in other window `C-c o'" . helm-buffer-switch-buffers-other-window)
|
||||
("Switch to browser buffer in other frame `C-c C-o'" . switch-to-buffer-other-frame)
|
||||
("Kill browser buffer(s)" . helm-kill-marked-buffers))
|
||||
;; When follow-mode is on, the persistent-action allows for multiple candidate selection.
|
||||
:persistent-action 'helm-buffers-list-persistent-action
|
||||
:update 'exwm/helm-update
|
||||
:keymap exwm/helm-browser-map)
|
||||
:buffer "*exwm/helm browser*")))
|
||||
:buffer "*exwm/helm browser*"))
|
||||
|
||||
(defun exwm-start-browser ()
|
||||
;; REVIEW: Does this work?
|
||||
(add-to-list 'helm-source-names-using-follow "exwm/helm browser"))
|
||||
|
||||
(defun exwm-start-browser (&optional other-window)
|
||||
"Fire-up the web browser as defined in `browse-url-generic-program'.
|
||||
If current window is the web browser already, fire-up a new window.
|
||||
If not, switch to the last open window.
|
||||
If there is none, fire it up."
|
||||
(interactive)
|
||||
If there is none, fire it up.
|
||||
|
||||
With prefix argument or if OTHER-WINDOW is non-nil, open in other window."
|
||||
(interactive "P")
|
||||
(if (and (eq major-mode 'exwm-mode)
|
||||
(string= (downcase exwm-class-name) (file-name-nondirectory browse-url-generic-program)))
|
||||
(if (fboundp 'exwm/helm-browser-buffers)
|
||||
(exwm/helm-browser-buffers)
|
||||
(when other-window (other-window 1))
|
||||
(start-process-shell-command browse-url-generic-program nil browse-url-generic-program))
|
||||
(let ((last (buffer-list)))
|
||||
(while (and last
|
||||
|
@ -146,9 +171,15 @@ If there is none, fire it up."
|
|||
(string= (downcase exwm-class-name) (file-name-nondirectory browse-url-generic-program))))))
|
||||
(setq last (cdr last)))
|
||||
(if last
|
||||
(switch-to-buffer (car last))
|
||||
(funcall (if other-window 'switch-to-buffer-other-window 'switch-to-buffer) (car last))
|
||||
(select-window (split-window))
|
||||
(start-process-shell-command browse-url-generic-program nil browse-url-generic-program)))))
|
||||
(defun exwm-start-browser-other-window ()
|
||||
"Like `exwm-start-browser' but use other window if possible."
|
||||
(interactive)
|
||||
(exwm-start-browser t))
|
||||
(exwm-input-set-key (kbd "s-w") #'exwm-start-browser)
|
||||
(exwm-input-set-key (kbd "s-W") #'exwm-start-browser-other-window)
|
||||
|
||||
;;; Lock screen
|
||||
(defvar exwm-lock-program "slock" "Shell command used to lock the screen.")
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
;;; TODO: Implement alternating-color multiline lists.
|
||||
;;; See https://github.com/emacs-helm/helm/issues/1790.
|
||||
|
||||
;;; TODO: Display relative line numbers in Helm.
|
||||
(when (require 'linum-relative nil t)
|
||||
(helm-linum-relative-mode 1))
|
||||
|
||||
(when (require 'helm-descbinds nil t)
|
||||
(helm-descbinds-mode))
|
||||
|
@ -54,6 +55,49 @@
|
|||
helm-window-show-buffers-function 'helm-window-mosaic-fn
|
||||
helm-window-prefer-horizontal-split t)
|
||||
|
||||
;;; REVIEW: Windowing configuration is way complicated. See
|
||||
;;; https://github.com/emacs-helm/helm/issues/1902.
|
||||
(defun helm-custom-display-buffer (buffer)
|
||||
"Custom function to display `helm-buffer' BUFFER."
|
||||
(display-buffer
|
||||
buffer `(nil . ((window-height . ,helm-display-buffer-default-height)
|
||||
(window-width . ,helm-display-buffer-default-width))))
|
||||
(helm-log-run-hook 'helm-window-configuration-hook))
|
||||
(defun helm-split-window-combined-fn (window)
|
||||
"Helm window splitting that combined most standard features.
|
||||
|
||||
- With C-u, split inside. With C-u C-u, use same window.
|
||||
- Else use biggest other window when available.
|
||||
- Else split horizontally if width>height, vertically otherwise."
|
||||
(cond
|
||||
((or (minibufferp helm-current-buffer)
|
||||
(and
|
||||
(not (one-window-p t))
|
||||
(not (equal current-prefix-arg '(4)))
|
||||
(not (equal current-prefix-arg '(16)))))
|
||||
;; Find biggest window.
|
||||
(let (biggest (maxarea 0))
|
||||
(dolist (w (window-list))
|
||||
(unless (eq w (selected-window))
|
||||
(let ((area (* (window-pixel-width w) (window-pixel-height w))))
|
||||
(when (> area maxarea)
|
||||
(setq maxarea area
|
||||
biggest w)))))
|
||||
biggest))
|
||||
((equal current-prefix-arg '(16))
|
||||
;; Same window.
|
||||
(selected-window))
|
||||
(t
|
||||
;; If split inside or if unique window.
|
||||
(split-window (selected-window) nil
|
||||
(if (> (window-pixel-width) (window-pixel-height))
|
||||
'right
|
||||
'below)))))
|
||||
(setq helm-display-function 'helm-custom-display-buffer
|
||||
helm-split-window-preferred-function 'helm-split-window-combined-fn)
|
||||
|
||||
|
||||
|
||||
;;; From https://github.com/emacs-helm/helm/issues/362.
|
||||
;;; This is not perfect with evil mode as the cursor type is not right in the
|
||||
;;; header line and the evil cursor remains in the minibuffer.
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
(funcall (if other-window 'find-file-other-window 'find-file) (car org-agenda-files))))))
|
||||
|
||||
(defun org-switch-agenda-file-other-window ()
|
||||
"Like `org-switch-agenda-file' but use other window when possible."
|
||||
"Like `org-switch-agenda-file' but use other window if possible."
|
||||
(interactive)
|
||||
(org-switch-agenda-file t))
|
||||
|
||||
|
|
Loading…
Reference in New Issue