From: Mark Wooding Date: Mon, 7 Dec 2009 09:45:50 +0000 (+0000) Subject: Merge commit 'origin' X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/782c3e35937e7438daf6073cddafdf21f4fc36fd?hp=-c Merge commit 'origin' * commit 'origin': el/dot-emacs.el: Make my writing be legible in ERC. bin/mdw-{editor,pager}: Recognize other Emacs terminal types. el/dot-emacs.el: Restore `gtags' mouse bindings. dot/emacs: Some Perforce tweaks. el/dot-emacs.el: Various bits of minor face hacking. el/dot-emacs.el: Force an update of the screen when setting faces. el/dot-emacs.el: Add `strayman' support at the right time. dot/emacs: Fix command to start the server. Conflicts: dot/emacs el/dot-emacs.el Resolved by removing gnuclient altogether. Now it's Emacsclient only. --- 782c3e35937e7438daf6073cddafdf21f4fc36fd diff --combined bin/mdw-editor index 96387e8,2c7535b..aa52fd5 --- a/bin/mdw-editor +++ b/bin/mdw-editor @@@ -2,16 -2,18 +2,19 @@@ 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) editor=emacsclient emacsclient=nil;; + mdw-editor,mdw-editor,dumb | \ + mdw-editor,mdw-editor,emacs | \ + mdw-editor,mdw-editor,eterm*) + editor=emacsclient emacsclient=nil;; mdw-editor,mdw-editor,*);; mdw-editor,*,*) editor=$VISUAL;; *,*,*) editor=$EDITOR;; esac case "$emacsclient" in t) exec emacsclient -nw -a "$editor" "$@";; - nil) exec $editor "$@";; + *) exec $editor "$@";; esac diff --combined dot/emacs index aa206cf,482e561..b1c5e4b --- a/dot/emacs +++ b/dot/emacs @@@ -59,6 -59,8 +59,8 @@@ (not mdw-fast-startup) (load "quilt")) + (trap (or mdw-fast-startup (require 'p4))) + (trap (or mdw-fast-startup (require 'tex-site))) (trap (or mdw-fast-startup (semantic-load-enable-minimum-features))) @@@ -87,10 -89,9 +89,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)) - (trap (gnuserv-start)))) ++ (trap (server-start)))) ;; Control backup behaviour. @@@ -447,7 -448,6 +448,7 @@@ ("\\.m$" . objc-mode) ("\\.mxd$" . c-mode) ("\\.cs$" . csharp-mode) + ("\\.go$" . go-mode) ("\\.org$" . org-mode) ;; ("/[ch]/" . c-mode) (,(concat "/\\(" @@@ -493,7 -493,7 +494,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 @@@ -564,7 -564,6 +565,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) @@@ -727,8 -726,8 +728,8 @@@ (setq shell-prompt-pattern "^[^]#$%>»}\n]*[]#$%>»}] *") (setq comint-password-prompt-regexp - (concat "\\(\\([Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)" - "[Pp]assword\\|pass phrase\\):\\s *\\'")) + (concat "\\(\\([Ee]nter \\|[Oo]ld \\|[Nn]ew \\|[a-zA-Z0-9_]*'s \\|^\\)" + "[Pp]assword\\|pass phrase\\):")) ;; Notice passwords, and make C-a work right. diff --combined el/dot-emacs.el index 7bb8214,784aad1..404233b --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@@ -233,7 -233,7 +233,7 @@@ Evil key bindings are defined in `mdw-e (dolist (key replacements) (define-key keymap key binding)))))) - (eval-after-load "org" + (eval-after-load "org-latex" '(progn (push '("strayman" "\\documentclass{strayman} @@@ -505,42 -505,6 +505,42 @@@ CHECK is fboundp, and returning the cor (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. @@@ -690,8 -654,14 +690,14 @@@ case. (trap (turn-on-font-lock))) (eval-after-load 'gtags - '(dolist (key '([mouse-2] [mouse-3])) - (define-key gtags-mode-map key nil))) + '(progn + (dolist (key '([mouse-2] [mouse-3])) + (define-key gtags-mode-map key nil)) + (define-key gtags-mode-map [C-S-mouse-2] 'gtags-find-tag-by-event) + (define-key gtags-select-mode-map [C-S-mouse-2] + 'gtags-select-tag-by-event) + (dolist (map (list gtags-mode-map gtags-select-mode-map)) + (define-key map [C-S-mouse-3] 'gtags-pop-stack)))) ;; Backup file handling. @@@ -714,24 -684,6 +720,24 @@@ doesn't match any of the regular expres 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 frame '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. @@@ -742,7 -694,8 +748,8 @@@ `(progn (make-face ',name) (defvar ,name ',name) - (put ',name 'face-defface-spec ',body))) + (put ',name 'face-defface-spec ',body) + (face-spec-set ',name ',body nil))) (mdw-define-face default (((type w32)) :family "courier new" :height 85) @@@ -752,6 -705,11 +759,11 @@@ (((type w32)) :family "courier new" :height 85) (((type x)) :family "6x13" :height 130) (t :foreground "white" :background "black")) + (if (>= emacs-major-version 23) + (mdw-define-face variable-pitch + (((type x)) :family "sans" :height 100)) + (mdw-define-face variable-pitch + (((type x)) :family "helvetica" :height 120))) (mdw-define-face region (((type tty)) :background "blue") (t :background "grey30")) (mdw-define-face minibuffer-prompt @@@ -766,9 -724,9 +778,9 @@@ (t :foreground "black" :background "lightgrey")) (mdw-define-face fringe (t :foreground "yellow")) - (mdw-define-face show-paren-match-face + (mdw-define-face show-paren-match (t :background "darkgreen")) - (mdw-define-face show-paren-mismatch-face + (mdw-define-face show-paren-mismatch (t :background "red")) (mdw-define-face highlight (t :background "DarkSeaGreen4")) @@@ -790,15 -748,13 +802,15 @@@ (mdw-define-face mdw-number-face (t :foreground "yellow")) (mdw-define-face font-lock-function-name-face - (t :weight bold)) + (t :slant italic)) (mdw-define-face font-lock-keyword-face (t :weight bold)) (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 @@@ -854,6 -810,9 +866,9 @@@ (t :foreground "red")) (mdw-define-face diff-context) + (mdw-define-face erc-input-face + (t :foreground "red")) + (mdw-define-face woman-bold (t :weight bold)) (mdw-define-face woman-italic @@@ -1289,39 -1248,6 +1304,39 @@@ (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. @@@ -2270,9 -2196,6 +2285,9 @@@ strip numbers instead. (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. @@@ -2306,21 -2229,6 +2321,21 @@@ (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)