chiark / gitweb /
Merge commit 'ponder'
authorMark Wooding <mdw@distorted.org.uk>
Thu, 10 Dec 2009 17:48:11 +0000 (17:48 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 10 Dec 2009 17:48:11 +0000 (17:48 +0000)
* 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.

bin/emacsclient-hack [new file with mode: 0755]
bin/mdw-editor
dot/emacs
dot/lisp-init.lisp
dot/xinitrc
el/dot-emacs.el
setup

diff --git a/bin/emacsclient-hack b/bin/emacsclient-hack
new file mode 100755 (executable)
index 0000000..8379edb
--- /dev/null
@@ -0,0 +1,2 @@
+#! /bin/sh -e
+exec emacsclient ${DISPLAY+--display "$DISPLAY"} "$@"
index 2c7535b58fbd2459c3a21095bf122b4fb739b211..aa52fd56b57a3c73cf62633906ad059fab3b2780 100755 (executable)
@@ -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
index c1e542aee3584d49fcfdf47115fb6bb771c0307f..649eaafa96af8655e29b0f745b8b8774809c5ce1 100644 (file)
--- 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.
 
                ("\\.m$" . objc-mode)
                ("\\.mxd$" . c-mode)
                ("\\.cs$" . csharp-mode)
+               ("\\.go$" . go-mode)
                ("\\.org$" . org-mode)
                ;; ("/[ch]/" . c-mode)
                (,(concat "/\\("
        '(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
   (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)
 
index 8da623d5e28f474e6a5906257a3f23835eca6366..6624c60c9407768a0b19e554e18304aba0a516b3 100644 (file)
@@ -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)
index f607193ea8ebd6e4b5e2021cf8d39ca42b046299..da8c51c1a3cdbe3bd10367b6dffb3c5d95e6ac0a 100755 (executable)
@@ -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
index 0a8d390bed254450f877c5f60a3d655d3deb325b..5cfc34b22c19962c0fc24b28e6ddee37f3376e87 100644 (file)
@@ -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 0bd95f64ab9b2625b53fa1822167b2da1fd89897..42c0cd71c5a32fcba30f28fdf1827b08536e9ec5 100755 (executable)
--- a/setup
+++ b/setup
@@ -213,6 +213,7 @@ scripts="
   mdw-pager
   mdw-conf
   mdw-build
+  emacsclient-hack
   movemail-hack
   emerge-hack
   lesspipe.sh