From: Mark Wooding Date: Thu, 10 Dec 2009 17:48:11 +0000 (+0000) Subject: Merge commit 'ponder' X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/6b440e3f1a67b73bb35b1469f18065d18aa5402e?hp=db10ce0a153621ddb8d66ae9a756bbccc828c088 Merge commit 'ponder' * commit 'ponder': el/dot-emacs.el: Lots of face settings for monochrome terminals. dot/emacs: Remove frame background setting. dot/emacs: Expunge `quilt' support. dot/emacs: Fix tramp runes. --- diff --git a/bin/emacsclient-hack b/bin/emacsclient-hack new file mode 100755 index 0000000..8379edb --- /dev/null +++ b/bin/emacsclient-hack @@ -0,0 +1,2 @@ +#! /bin/sh -e +exec emacsclient ${DISPLAY+--display "$DISPLAY"} "$@" diff --git a/bin/mdw-editor b/bin/mdw-editor index 2c7535b..aa52fd5 100755 --- a/bin/mdw-editor +++ b/bin/mdw-editor @@ -2,7 +2,8 @@ set -e editor=${MDW_EDITOR-ed} -emacsclient=t +emacsclient=$( + emacsclient --eval '(>= emacs-major-version 23)' 2>/dev/null || :) [ -t 0 -a -t 1 ] || TERM=dumb case "$EDITOR,$VISUAL,$TERM" in mdw-editor,mdw-editor,dumb | \ @@ -15,5 +16,5 @@ case "$EDITOR,$VISUAL,$TERM" in esac case "$emacsclient" in t) exec emacsclient -nw -a "$editor" "$@";; - nil) exec $editor "$@";; + *) exec $editor "$@";; esac diff --git a/dot/emacs b/dot/emacs index c1e542a..649eaaf 100644 --- a/dot/emacs +++ b/dot/emacs @@ -87,9 +87,9 @@ ;; Emacs server behaviour. (and (or window-system (>= emacs-major-version 23)) - (trap (setq server-temp-file-regexp (concat "^" tmpdir "\\|/draft$")) - (server-start) - (gnuserv-start))) + (progn (setq server-temp-file-regexp (concat "^" tmpdir "\\|/draft$") + gnuserv-frame t) + (trap (server-start)))) ;; Control backup behaviour. @@ -445,6 +445,7 @@ ("\\.m$" . objc-mode) ("\\.mxd$" . c-mode) ("\\.cs$" . csharp-mode) + ("\\.go$" . go-mode) ("\\.org$" . org-mode) ;; ("/[ch]/" . c-mode) (,(concat "/\\(" @@ -490,7 +491,7 @@ '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook csharp-mode-hook perl-mode-hook cperl-mode-hook python-mode-hook pyrec-mode-hook icon-mode-hook awk-mode-hook - tcl-mode-hook + tcl-mode-hook go-mode-hook asm-mode-hook TeX-mode-hook LaTeX-mode-hook TeXinfo-mode-hook tex-mode-hook latex-mode-hook texinfo-mode-hook emacs-lisp-mode-hook scheme-mode-hook @@ -557,6 +558,7 @@ (add-hook 'c++-mode-hook 'mdw-fontify-c-and-c++ t) (add-hook 'linux-c-mode-hook #'(lambda () (setq c-basic-offset 8))) (add-hook 'asm-mode-hook 'mdw-fontify-asm t) + (add-hook 'go-mode-hook 'mdw-fontify-go t) (add-hook 'icon-mode-hook 'mdw-fontify-icon t) diff --git a/dot/lisp-init.lisp b/dot/lisp-init.lisp index 8da623d..6624c60 100644 --- a/dot/lisp-init.lisp +++ b/dot/lisp-init.lisp @@ -20,6 +20,8 @@ (defun mdw-hacks:crank-swank (&rest #1=#:args) (set (find-symbol "*GLOBAL-DEBUGGER*" #2#) nil) (apply (find-symbol "CREATE-SERVER" #2#) #1#))) +#+asdf (setf asdf:*compile-file-failure-behaviour* :warn) + ;; Done. (pushnew :mdw *features*) ;;#+(and cmu mp) (mp::startup-idle-and-top-level-loops) diff --git a/dot/xinitrc b/dot/xinitrc index f607193..da8c51c 100755 --- a/dot/xinitrc +++ b/dot/xinitrc @@ -137,7 +137,7 @@ start-clients () { case $vnc in no) run bginit gnome-panel ;; esac ## System tray. - run bginit stalonetray + ## run bginit stalonetray ## Local clients. start-clients-local diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 0a8d390..5cfc34b 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -505,6 +505,42 @@ (defun mdw-good-url-browser () (setq answer func))) answer)) +(eval-after-load "w3m-search" + '(progn + (dolist + (item + '(("g" "Google" "http://www.google.co.uk/search?q=%s") + ("gd" "Google Directory" + "http://www.google.com/search?cat=gwd/Top&q=%s") + ("gg" "Google Groups" "http://groups.google.com/groups?q=%s") + ("ward" "Ward's wiki" "http://c2.com/cgi/wiki?%s") + ("gi" "Images" "http://images.google.com/images?q=%s") + ("rfc" "RFC" + "http://metalzone.distorted.org.uk/ftp/pub/mirrors/rfc/rfc%s.txt.gz") + ("wp" "Wikipedia" + "http://en.wikipedia.org/wiki/Special:Search?go=Go&search=%s") + ("imdb" "IMDb" "http://www.imdb.com/Find?%s") + ("nc-wiki" "nCipher wiki" + "http://wiki.ncipher.com/wiki/bin/view/Devel/?topic=%s") + ("map" "Google maps" "http://maps.google.co.uk/maps?q=%s&hl=en") + ("lp" "Launchpad bug by number" + "https://bugs.launchpad.net/bugs/%s") + ("lppkg" "Launchpad bugs by package" + "https://bugs.launchpad.net/%s") + ("msdn" "MSDN" + "http://social.msdn.microsoft.com/Search/en-GB/?query=%s&ac=8") + ("debbug" "Debian bug by number" + "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s") + ("debbugpkg" "Debian bugs by package" + "http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=%s") + ("ljlogin" "LJ login" "http://www.livejournal.com/login.bml"))) + (add-to-list 'w3m-search-engine-alist + (list (cadr item) (caddr item) nil)) + (add-to-list 'w3m-uri-replace-alist + (list (concat "\\`" (car item) ":") + 'w3m-search-uri-replace + (cadr item)))))) + ;;;-------------------------------------------------------------------------- ;;; Paragraph filling. @@ -684,6 +720,24 @@ (defun mdw-backup-enable-predicate (name) answer)))) (setq backup-enable-predicate 'mdw-backup-enable-predicate) +;; Frame cleanup. + +(defun mdw-last-one-out-turn-off-the-lights (frame) + "Disconnect from an X display if this was the last frame on that display." + (let ((frame-display (frame-parameter frame 'display))) + (when (and frame-display + (eq window-system 'x) + (not (some (lambda (fr) + (message "checking frame %s" frame) + (and (not (eq fr frame)) + (string= (frame-parameter fr 'display) + frame-display) + (progn "frame %s still uses us" nil))) + (frame-list)))) + (message "turn out the lights") + (run-with-idle-timer 0 nil #'x-close-connection frame-display)))) +(add-hook 'delete-frame-functions 'mdw-last-one-out-turn-off-the-lights) + ;;;-------------------------------------------------------------------------- ;;; General fontification. @@ -763,6 +817,8 @@ (mdw-define-face font-lock-constant-face (t :slant italic)) (mdw-define-face font-lock-builtin-face (t :weight bold)) +(mdw-define-face font-lock-type-face + (t :weight bold :slant italic)) (mdw-define-face font-lock-reference-face (t :weight bold)) (mdw-define-face font-lock-variable-name-face @@ -1258,6 +1314,39 @@ (defun mdw-fontify-csharp () (define-derived-mode csharp-mode java-mode "C#" "Major mode for editing C# code.") +;;;-------------------------------------------------------------------------- +;;; Go programming configuration. + +(defun mdw-fontify-go () + + (make-local-variable 'font-lock-keywords) + (let ((go-keywords + (mdw-regexps "break" "case" "chan" "const" "continue" + "default" "defer" "else" "fallthrough" "for" + "func" "go" "goto" "if" "import" + "interface" "map" "package" "range" "return" + "select" "struct" "switch" "type" "var"))) + + (setq font-lock-keywords + (list + + ;; Handle the keywords defined above. + (list (concat "\\<\\(" go-keywords "\\)\\>") + '(0 font-lock-keyword-face)) + + ;; Handle numbers too. + ;; + ;; The following isn't quite right, but it's close enough. + (list (concat "\\<\\(" + "0\\([xX][0-9a-fA-F]+\\|[0-7]+\\)\\|" + "[0-9]+\\(\\.[0-9]*\\|\\)" + "\\([eE]\\([-+]\\|\\)[0-9]+\\|\\)\\)") + '(0 mdw-number-face)) + + ;; And anything else is punctuation. + (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" + '(0 mdw-punct-face)))))) + ;;;-------------------------------------------------------------------------- ;;; Awk programming configuration. @@ -2206,6 +2295,9 @@ (defun mdw-outline-collapse-all () (setq hs-hide-comments-when-hiding-all nil) +(defadvice hs-hide-all (after hide-first-comment activate) + (save-excursion (hs-hide-initial-comment-block))) + ;;;-------------------------------------------------------------------------- ;;; Shell mode. @@ -2239,6 +2331,21 @@ (define-key term-raw-map [?\e ?\M-O ?C] 'term-send-meta-right) (define-key term-raw-map [M-left] 'term-send-meta-left) (define-key term-raw-map [?\e ?\M-O ?D] 'term-send-meta-left))) +;;;-------------------------------------------------------------------------- +;;; Inferior Emacs Lisp. + +(setq comint-prompt-read-only t) + +(eval-after-load "comint" + '(progn + (define-key comint-mode-map "\C-w" 'comint-kill-region) + (define-key comint-mode-map [C-S-backspace] 'comint-kill-whole-line))) + +(eval-after-load "ielm" + '(progn + (define-key ielm-map "\C-w" 'comint-kill-region) + (define-key ielm-map [C-S-backspace] 'comint-kill-whole-line))) + ;;;----- That's all, folks -------------------------------------------------- (provide 'dot-emacs) diff --git a/setup b/setup index 0bd95f6..42c0cd7 100755 --- a/setup +++ b/setup @@ -213,6 +213,7 @@ scripts=" mdw-pager mdw-conf mdw-build + emacsclient-hack movemail-hack emerge-hack lesspipe.sh