Emacs: finally found decent a solution to all emacsclient issues!!! Emacs light

configuration (.emacs-light) is not used for the moment. Integration with
       Git needs some testing. Ranger and Mutt work perfectly. Besides, it
       should work for multi-users environment.
master
Pierre Neidhardt 2013-01-09 19:25:23 +01:00
parent f3b5868273
commit ab84bb6440
7 changed files with 36 additions and 29 deletions

1
.emacs
View File

@ -10,6 +10,7 @@
(load "~/.emacs.d/theme.el" nil t)
(load "~/.emacs.d/modes.el" nil t)
(load "~/.emacs.d/functions.el" nil t)
(load "~/.emacs.d/plugins.el" nil t)
;; End of file

View File

@ -10,7 +10,6 @@
(load "~/.emacs.d/theme.el" nil t)
(load "~/.emacs.d/modes.el" nil t)
(load "~/.emacs.d/functions.el" nil t)
(load "~/.emacs.d/plugins.el" nil t)
;; End of file

View File

@ -20,6 +20,13 @@ SOURCEDIR="${HOME}/personal/dataperso"
[ -z "$XDG_DATA_HOME" ] && XDG_DATA_HOME="$HOME/.local/share"
[ -z "$XDG_DATA_DIRS" ] && XDG_DATA_DIRS="/usr/local/share"
## 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 /bin/em ]; then
sudo sh -c "echo '#!/bin/sh
emacsclient -a \"\" -t \"\$@\"' > '/bin/em'"
fi
## Mutt
echo "==> Mutt"
ln -snf "$(realpath ${SOURCEDIR}/mails)" "${HOME}/.mutt"
@ -70,3 +77,4 @@ fi
ln -sf "${SOURCEDIR}/bookmarks/bookmarks" "$BROWSER_DATA_DIR"
ln -sf "${SOURCEDIR}/bookmarks/quickmarks" "$BROWSER_DATA_DIR"
echo

View File

@ -1,7 +1,7 @@
## -*- mode:sh -*- #
################################################################################
## Mutt Configuration
## Date 2012-10-28
## Date 2013-01-09
################################################################################
## Note on folders:
@ -14,10 +14,10 @@
## General options
##-------------------------------------------------------------------------------
## TODO: why doesn't the $EDITOR variable work for connection to emacs daemon?
## Seems like $EDITOR is internal to Mutt, whereas variable set between
## backquotes are external.
set editor=`echo \$EDITOR`
## backquotes are external. Mutt will use env EDITOR variable, so we do not
## really need to set it.
# set editor=`echo \$EDITOR`
# set editor="emacsclient -a \"\" -t"
## Mailcap

View File

@ -95,24 +95,10 @@ alias xmorphzi='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ")
##==============================================================================
## Emacs
##==============================================================================
## For the systemd unit, write the following file:
## /etc/systemd/system/emacs@.service
# [Unit]
# Description=Emacs: the extensible, self-documenting text editor
#
# [Service]
# Type=forking
# ExecStart=/usr/bin/emacs --daemon
# ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
# Restart=always
# User=%i
#
# [Install]
# WantedBy=multi-user.target
if [ -n "$(command -v emacs)" ]; then
alias em='emacsclient -a "" -t'
alias emacs-reload="emacsclient -e '(kill-emacs)' >/dev/null 2>&1; emacs --daemon -q -l ~/.emacs-full"
# alias emacs-reload="sudo systemctl restart emacs@$USER"
# See .homeinit
if [ -f /bin/em ]; then
alias ema='emacs -q -l ~/.emacs-light'
alias emacs-reload="emacsclient -e '(kill-emacs)' >/dev/null 2>&1; emacs --daemon"
fi
##==============================================================================
@ -125,7 +111,7 @@ fi
#alias -g L='| less'
## Now just type the image name to launch irfanview
#alias -s jpg='/usr/bin/gpicview'
#alias -s jpg='/usr/bin/sxiv'
# fi

View File

@ -76,7 +76,11 @@ if [ -n "$(command -v vim)" ]; then
EDITOR=vim
fi
if [ -n "$(command -v emacs)" ]; then
EDITOR='emacsclient -a "" -t'
EDITOR='emacs'
fi
## 'em' is a script for emacsclient. See '.homeinit'.
if [ -f "/bin/em" ]; then
EDITOR='em'
fi
export EDITOR
@ -92,3 +96,14 @@ export EDITOR
#*)
# ;;
#esac
## SSH-Agent
if [ $(ps ax -o command="" | grep -c "ssh-agent") -eq 1 ]; then
SSH_AGENT_VARS=$(ssh-agent)
eval $(echo ${SSH_AGENT_VARS})
echo ${SSH_AGENT_VARS} | sed '2q' > "$HOME/.ssh/agent_env"
unset $SSH_AGENT_VARS
else
eval $(cat "$HOME/.ssh/agent_env")
fi

6
README
View File

@ -156,10 +156,8 @@ I've only been a casual Vim user, so do not expect too much from it.
Known issues
************
Emacs: some colors do not work as intended.
Ranger: if editor is 'emacsclient -t -a ""', it will not show up if emacs daemon
is not running. This is because the "" are not properly recognized.
Emacs: some colors do not work as intended. MediaWiki fails to upload pages
after some idle time.
Shell: some custom functions would need auto-completion.