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.* /fish/fishd.*
*~

View file

@ -43,6 +43,10 @@
;;; terminal ;;; terminal
(define-key *root-map* (kbd "c") "exec urxvt") (define-key *root-map* (kbd "c") "exec urxvt")
;;; es as emacs
(define-key *root-map* (kbd "e") "exec es")
;;; groups to rpws keys ;;; groups to rpws keys
(define-key *root-map* (kbd "C-1") "change-workspace 1") (define-key *root-map* (kbd "C-1") "change-workspace 1")
(define-key *root-map* (kbd "C-2") "change-workspace 2") (define-key *root-map* (kbd "C-2") "change-workspace 2")
@ -134,3 +138,19 @@
"Switch workspace" "Switch workspace"
(run-commands (concatenate 'string "gselect " n)) (run-commands (concatenate 'string "gselect " n))
(echo (concatenate 'string "Switched to " 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 ;;; diff-hl
(global-diff-hl-mode t) (global-diff-hl-mode t)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh) (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 end
if [ -z $EDITOR ] if [ -z $EDITOR ]
set -Ux EDITOR nvim set -Ux EDITOR es
end end
if [ -z $VISUAL ] if [ -z $VISUAL ]
set -Ux VISUAL nvim set -Ux VISUAL es
end end
if [ -z $GOPATH ] if [ -z $GOPATH ]