diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-01-02 23:29:09 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-01-02 23:29:09 +1300 |
commit | 1c96eaf0b739228c3a2353f3f015d0258e052d03 (patch) | |
tree | b9d64393e8de6ba0d611737cfa283d90f0714e70 | |
parent | Merge branch 'release/v4.4.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-1c96eaf0b739228c3a2353f3f015d0258e052d03.tar.gz dotfiles-1c96eaf0b739228c3a2353f3f015d0258e052d03.zip |
Merge branch 'release/v4.5.0'v4.5.0
* release/v4.5.0:
Bump VERSION
Add some more elementary Emacs configuration
Add Emacs settings for message-mode
Tidy packages list in .emacs a bit
Add emacsclient logic to $VISUAL set
Don't edit message headers using Emacs
Add new filetype pattern for muttrc
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | emacs/emacs | 29 | ||||
-rwxr-xr-x | mutt/muttrc.d/src | 7 | ||||
-rw-r--r-- | sh/profile.d/visual.sh | 24 | ||||
-rw-r--r-- | vim/filetype.vim | 1 |
5 files changed, 58 insertions, 7 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v4.4.0 -Mon Dec 31 23:39:00 UTC 2018 +tejr dotfiles v4.5.0 +Wed Jan 2 10:29:09 UTC 2019 diff --git a/emacs/emacs b/emacs/emacs index a80f36a1..637f8053 100644 --- a/emacs/emacs +++ b/emacs/emacs @@ -1,7 +1,34 @@ +;; Package setup (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (package-initialize) (custom-set-variables '(package-selected-packages - (quote (markdown-mode fireplace)))) + (quote ( + fireplace + markdown-mode + vimrc-mode + )))) + +;; Still trying to get mail to behave properly +(add-to-list 'auto-mode-alist '("/mutt" . mail-mode)) +(add-hook 'mail-mode-hook 'auto-fill-mode) +(add-hook 'mail-mode-hook 'use-hard-newlines) + +;; From better-defaults.el <https://github.com/technomancy/better-defaults/blob/master/better-defaults.el> +(show-paren-mode 1) +(setq-default indent-tabs-mode nil) +(setq + require-final-newline t + visible-bell t + save-place-file (concat user-emacs-directory "places") + backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))) +) + +;; A few more options I've found around the web +(customize-set-variable 'inhibit-startup-screen t) +(column-number-mode 1) +(line-number-mode 1) +(menu-bar-mode -1) +(tool-bar-mode -1) diff --git a/mutt/muttrc.d/src b/mutt/muttrc.d/src index 584a2785..cc2eb4ef 100755 --- a/mutt/muttrc.d/src +++ b/mutt/muttrc.d/src @@ -4,3 +4,10 @@ for rc in "$HOME"/.muttrc.d/*.rc ; do [ -e "$rc" ] || continue cat -- "$rc" done + +# Special case: if using GNU Emacs, emit a line to disable edit_headers, just +# because at the moment I haven't worked out how to make this work sanely with +# messages-are-flowing in message-mode. +case $VISUAL in + emacs|emacsclient) printf 'set edit_headers = no\n' ;; +esac diff --git a/sh/profile.d/visual.sh b/sh/profile.d/visual.sh index 94aee963..359bf13a 100644 --- a/sh/profile.d/visual.sh +++ b/sh/profile.d/visual.sh @@ -1,9 +1,25 @@ -# If emacs is installed, and ~/.emacs exists, use emacs as the visual editor; -# otherwise, use the system's vi +# If an Emacs is installed, and ~/.emacs exists, use emacs as the visual +# editor; otherwise, use the system's vi if command -v emacs >/dev/null 2>&1 && - [ -f "$HOME"/.emacs ] ; then - VISUAL=emacs + [ -f "$HOME"/.emacs ] ; then + + # Use or start a GNU Emacs client, if possible + if command -v pgrep >/dev/null 2>&1 && + pgrep --exact --full --euid="$USER" \ + 'emacs --daemon' >/dev/null || + emacs --daemon >/dev/null ; then + VISUAL=emacsclient + + # If no GNU Emacs daemon is available, just create a new instance every + # time + else + VISUAL=emacs + fi + +# If an Emacs isn't installed, just use good old vi else VISUAL=vi fi + +# Export final editor decision export VISUAL diff --git a/vim/filetype.vim b/vim/filetype.vim index 3ac816d4..2a5725dc 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -204,6 +204,7 @@ augroup filetypedetect \ Muttrc \,*/.muttrc.d/*.rc \,.muttrc + \,muttrc \,/etc/Muttrc.d/* \ setfiletype muttrc " BIND configuration file |