Browse Source

Some code that I thought would fix the slurp problem but doesnt

master
Taylor Bockman 9 years ago
parent
commit
76052cb261
  1. 14
      dotfiles/emacs.d/init.el
  2. 38
      dotfiles/emacs.d/urxvt-bindings.el

14
dotfiles/emacs.d/init.el

@ -42,6 +42,20 @@
(setq inhibit-splash-screen t)
;;--------------------------------------------------------------------------------------
;; Conditionally load urxvt files to fix weird bindings
;;--------------------------------------------------------------------------------------
;; This code doesn't fix anything related to emacs -nw not allowing C-) in terminal
;; mode. Currently looking for solutions so I don't have to keep using C-<left>
;; and C-<right>
;;
;; (when (string= (getenv "TERM") "rxvt")
;; (load "term/rxvt")
;; (terminal-init-rxvt)
;; (load "~/.emacs.d/urxvt-bindings.el")
;; )
;;--------------------------------------------------------------------------------------
;; Enable auto-refresh to keep buffers up to date when git or another program
;; modifies them
;;--------------------------------------------------------------------------------------

38
dotfiles/emacs.d/urxvt-bindings.el

@ -0,0 +1,38 @@
;; This file adds the missing escape sequences for urxvt so emacs -nw
;; will work with Ctrl+Shift, Ctrl+Meta, etc sequences.
;;
;; Credit for the original code goes to Gilles on emacs.stackexchange.com
;;
(defun character-apply-modifiers (c &rest modifiers)
"Apply modifiers to the character C.
MODIFIERS must be a list of symbols amongst (meta control shift).
Return an event vector."
(if (memq 'control modifiers) (setq c (if (or (and (<= ?@ c) (<= c ?_))
(and (<= ?a c) (<= c ?z)))
(logand c ?\x1f)
(logior (lsh 1 26) c))))
(if (memq 'meta modifiers) (setq c (logior (lsh 1 27) c)))
(if (memq 'shift modifiers) (setq c (logior (lsh 1 25) c)))
(vector c))
(defun eval-after-load-urxvt ()
(when (and (boundp 'rxvt-alternatives-map) (boundp 'rxvt-function-map))
(let ((c 32))
(while (<= c 126)
(mapc (lambda (x)
(define-key rxvt-function-map (format (car x) c)
(apply 'character-apply-modifiers c (cdr x))))
'(
("\e\[27;3;%d~" meta)
("\e\[27;5;%d~" control)
("\e\[27;6;%d~" control shift)
("\e\[27;7;%d~" control meta)
("\e\[27;8;%d~" control meta shift)
("\e\[%d;3~" meta)
("\e\[%d;5~" control)
("\e\[%d;6~" control shift)
("\e\[%d;7~" control meta)
("\e\[%d;8~" control meta shift)))
(setq c (1+ c))))))
(eval-after-load "rxvt" '(eval-after-load-urxvt))
Loading…
Cancel
Save