Emacs: graphical support.

master
Pierre Neidhardt 2013-05-24 11:44:23 +02:00
parent a0dda0afd1
commit ea0bd30dc9
5 changed files with 69 additions and 39 deletions

View File

@ -17,6 +17,11 @@
;; Default mode
(setq default-major-mode 'text-mode)
;; For convenience.
(setq inhibit-startup-screen t)
(if (display-graphic-p) (tool-bar-mode -1)) ;; (toggle-tool-bar-mode-from-frame)
(menu-bar-mode -1)
;; Make questions less annoying.
(defalias 'yes-or-no-p 'y-or-n-p)
@ -38,12 +43,15 @@
(beginning-of-buffer (goto-char (point-min))))))
;; Line numbers
;; TODO: This mode is really messy. Replace it.
(autoload 'linum-mode "linum" "toggle line numbers on/off" t)
;; (setq linum-format "%-4d ")
(setq linum-format "%d ")
(global-linum-mode 1) ;; TODO: This may generate warnings with emacsclient. Bug?
;; (global-linum-mode 1) ;; TODO: This may generate warnings with emacsclient. Bug?
(add-hook 'find-file-hook (lambda () (linum-mode 1)))
(define-key my-keys-minor-mode-map (kbd "C-<f5>") 'linum-mode) ;; Toggle line numbers.
;; Indentation
;(setq standard-indent 4)
(setq-default tab-width 4)
@ -90,9 +98,6 @@
;; (setq version-control t) ;; Enable numbered versioning.
(setq backup-directory-alist (quote ((".*" . "~/.emacs.d/backups/")))) ;; Save all backup file in this directory.
;; Remove menu-bar
(menu-bar-mode -1)
;; Set Fill Column
(setq-default fill-column 80)
;; (auto-fill-mode 1) ;; Will not work because it gets overridden by major modes.

View File

@ -6,33 +6,36 @@
;; on it and call 'customize-face'.
;; General
(set-face-foreground 'default "white" )
(set-face-background 'default "black" )
(set-face-foreground 'link "brightblue" )
(set-face-underline-p 'link t)
(set-face-foreground 'minibuffer-prompt "brightcyan" )
(set-face-background 'region "color-235")
(set-face-background 'shadow "color-234" ) ;; For line numbers.
(set-face-background 'isearch "color-17" )
(set-face-background 'region "#262626")
(set-face-background 'shadow "#1c1c1c" ) ;; For line numbers.
(set-face-background 'isearch "#00002a" )
(set-face-foreground 'isearch nil )
(set-face-background 'isearch-lazy-highlight-face "color-237" )
(set-face-background 'isearch-lazy-highlight-face "#3a3a3a" )
(if (string-match "^24.*" emacs-version )
(progn
(set-face-foreground 'error "red")
(set-face-bold-p 'error t)))
;; Programming
(set-face-foreground 'font-lock-builtin-face "color-75" )
(set-face-foreground 'font-lock-builtin-face "#2a80d4" )
(set-face-bold-p 'font-lock-builtin-face t )
(set-face-foreground 'font-lock-comment-delimiter-face "color-242" )
(set-face-foreground 'font-lock-comment-face "color-242" )
(set-face-foreground 'font-lock-constant-face "color-105" )
(set-face-foreground 'font-lock-doc-face "color-28" )
(set-face-foreground 'font-lock-function-name-face "color-75" )
(set-face-foreground 'font-lock-comment-delimiter-face "#6c6c6c" )
(set-face-foreground 'font-lock-comment-face "#6c6c6c" )
(set-face-foreground 'font-lock-constant-face "#5555d4" )
(set-face-foreground 'font-lock-doc-face "#005500" )
(set-face-foreground 'font-lock-function-name-face "#2a80d4" )
(set-face-bold-p 'font-lock-function-name-face t )
(set-face-foreground 'font-lock-keyword-face "brightred" )
(set-face-bold-p 'font-lock-keyword-face t )
(set-face-foreground 'font-lock-preprocessor-face "color-99" )
(set-face-foreground 'font-lock-string-face "color-39" )
(set-face-foreground 'font-lock-type-face "color-166" )
(set-face-foreground 'font-lock-preprocessor-face "#552ad4" )
(set-face-foreground 'font-lock-string-face "#0080d4" )
(set-face-foreground 'font-lock-type-face "#aa2a00" )
(set-face-foreground 'font-lock-variable-name-face "brightyellow" )
(set-face-foreground 'font-lock-warning-face "DarkOrange" )
@ -40,25 +43,25 @@
(add-hook
'ediff-mode-hook
(lambda ()
(set-face-background 'ediff-fine-diff-A "color-52")
(set-face-background 'ediff-fine-diff-A "#2a0000")
(set-face-foreground 'ediff-fine-diff-A nil)
(set-face-background 'ediff-fine-diff-B "color-52")
(set-face-background 'ediff-fine-diff-B "#2a0000")
(set-face-foreground 'ediff-fine-diff-B nil)
(set-face-background 'ediff-fine-diff-C "color-52")
(set-face-background 'ediff-fine-diff-C "#2a0000")
(set-face-foreground 'ediff-fine-diff-C nil)
(set-face-background 'ediff-current-diff-A "color-17")
(set-face-background 'ediff-current-diff-A "#00002a")
(set-face-foreground 'ediff-current-diff-A nil)
(set-face-background 'ediff-current-diff-B "color-17")
(set-face-background 'ediff-current-diff-B "#00002a")
(set-face-foreground 'ediff-current-diff-B nil)
(set-face-background 'ediff-current-diff-C "color-17")
(set-face-background 'ediff-current-diff-C "#00002a")
(set-face-foreground 'ediff-current-diff-C nil)
(set-face-background 'ediff-even-diff-A "color-236")
(set-face-background 'ediff-even-diff-A "#303030")
(set-face-foreground 'ediff-even-diff-A nil)
(set-face-background 'ediff-even-diff-B "color-236")
(set-face-background 'ediff-even-diff-B "#303030")
(set-face-foreground 'ediff-even-diff-B nil)
(set-face-background 'ediff-even-diff-C "color-236")
(set-face-background 'ediff-even-diff-C "#303030")
(set-face-foreground 'ediff-even-diff-C nil)
(set-face-background 'ediff-odd-diff-A "brightblack")

13
.mutt.d/maileditor.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
## Seems like $EDITOR is internal to Mutt, whereas variable set between
## backquotes are external. By default Mutt will use env EDITOR variable, so we
## do not really need to set it.
# set editor=`echo \$EDITOR`
## If graphical emacs is used, we need to use a non-terminating client.
if [ $EDITOR = "em" ]; then
cat <<EOF
set editor="emacsclient -a \"\" -t"
EOF
fi

11
.muttrc
View File

@ -19,11 +19,8 @@ set beep_new = "yes"
## Headers are editable in editor.
set edit_headers=yes
## Seems like $EDITOR is internal to Mutt, whereas variable set between
## backquotes are external. By default Mutt will use env EDITOR variable, so we
## do not really need to set it.
# set editor=`echo \$EDITOR`
# set editor="emacsclient -a \"\" -t"
## Set EDITOR dynamically.
source "~/.mutt.d/maileditor.sh|"
## Store message headers locally to speed things up. Gentoo wiki says that if a
## folder is specified, it is even faster. If no folder exists, the cache will
@ -136,7 +133,9 @@ macro pager b '<enter-command>toggle sidebar_visible<enter><redraw-screen>'
# source $alias_file
## Abook
set query_command= "abook --mutt-query '%s'"
## We redirect the error stream in case the config file in not compatible with
## current abook bersion.
set query_command= "abook --mutt-query '%s' 2>/dev/null"
macro index,pager a "<pipe-message>abook --add-email-quiet<return>" "Add this sender to Abook"
bind editor <Tab> complete-query

View File

@ -14,12 +14,22 @@ mkdir -p temp
echo
## Emacsclient launcher. Required for best emacsclient integration. For a fully
## functional daemon, you should write a file like this and set 'EDITOR=em'.
if [ ! -f /usr/local/bin/em ]; then
echo "==> Emacs (press Ctrl-D to skip)"
sudo sh -c "echo '#!/bin/sh
emacsclient -a \"\" -t \"\$@\"' > '/usr/local/bin/em'; chmod 755 /usr/local/bin/em"
echo
## functional daemon, you should write a file like this and set 'EDITOR=em'. We
## use base64 to encode the script so that we do not need to handle all the
## escape sequences with quotes and so on.
EMFILE='/usr/local/bin/em'
if [ -n "$(command -v emacs)" ] && [ ! -f "$EMFILE" ]; then
echo "==> Emacs (press Ctrl-D to skip)"
if [ -z "$(command -v base64)" ]; then
echo ":: base64 not found."
else
sudo sh -c "echo 'IyEvYmluL3NoCklTX0dSQVBISUNBTD0kKGVtYWNzIC1iYXRjaCAtUSAtLWV2YWw9JyhpZiAoZmJv
dW5kcCAnIiciJ3Rvb2wtYmFyLW1vZGUpIChtZXNzYWdlICIxIikgKG1lc3NhZ2UgIjAiKSknIDI+
JjEpCgppZiBbICRJU19HUkFQSElDQUwgLWVxIDEgXTsgdGhlbgogICAgZW1hY3NjbGllbnQgLWEg
IiIgLWMgIiRAIgplbHNlCiAgICBlbWFjc2NsaWVudCAtYSAiIiAtdCAiJEAiCmZpCg==' | base64 -d > "'"'"$EMFILE"'"'"
chmod 755 "'"'"$EMFILE"'"'""
fi
fi
if [ -d "$SOURCEDIR" ]; then
@ -104,4 +114,4 @@ if [ -d "$SOURCEDIR" ]; then
echo "==> Launchers"
ln -snf "${SOURCEDIR}/launchers" "${HOME}/.launchers"
echo
fi
fi