Connected stumpwm with emacsclient

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-12-23 22:06:39 +01:00
parent 04479fd97f
commit 1f52a78d2f
5 changed files with 38 additions and 2 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/fish/fishd.*
*~

View File

@ -43,6 +43,10 @@
;;; terminal
(define-key *root-map* (kbd "c") "exec urxvt")
;;; es as emacs
(define-key *root-map* (kbd "e") "exec es")
;;; groups to rpws keys
(define-key *root-map* (kbd "C-1") "change-workspace 1")
(define-key *root-map* (kbd "C-2") "change-workspace 2")
@ -134,3 +138,19 @@
"Switch workspace"
(run-commands (concatenate 'string "gselect " n))
(echo (concatenate 'string "Switched to " n)))
;; working with emacsclient
(defvar *es-win* nil
"to hold the window called emacsclient")
(defun save-es-called-win ()
(setf *es-win* (current-window)))
(defun return-es-called-window (win)
(let* ((group (window-group win))
(frame (window-frame win))
(old-frame (tile-group-current-frame group)))
(frame-raise-window group frame win)
(focus-all win)
(unless (eq frame old-frame)
(show-frame-indicator group))))

View File

@ -119,3 +119,14 @@
;;; diff-hl
(global-diff-hl-mode t)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
;; stumpwm: working with emacsclient
(add-hook 'after-init-hook 'server-start)
(setq server-raise-frame t)
(if window-system
(add-hook 'server-done-hook
(lambda ()
(shell-command
"stumpish 'eval (stumpwm::return-es-called-win stumpwm::*es-win*)'"))))

4
es.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
stumpish 'eval (stumpwm::save-es-called-win)' > /dev/null
emacsclient -c --alternate-editor=$ALTERNATE_EDITOR "$@"

View File

@ -41,11 +41,11 @@ if [ -z $SSH_CLIENT ]
end
if [ -z $EDITOR ]
set -Ux EDITOR nvim
set -Ux EDITOR es
end
if [ -z $VISUAL ]
set -Ux VISUAL nvim
set -Ux VISUAL es
end
if [ -z $GOPATH ]