el/dot-emacs.el: Wrap `trap' defintiion in `eval-and-compile'.
[profile] / el / dot-emacs.el
index 12c3b21..3bed078 100644 (file)
@@ -87,15 +87,16 @@ This may be at the expense of cool features.")
 ;; If individual bits of this file go tits-up, we don't particularly want
 ;; the whole lot to stop right there and then, because it's bloody annoying.
 
-(defmacro trap (&rest forms)
-  "Execute FORMS without allowing errors to propagate outside."
-  (declare (indent 0)
-          (debug t))
-  `(condition-case err
-       ,(if (cdr forms) (cons 'progn forms) (car forms))
-     (error (message "Error (trapped): %s in %s"
-                    (error-message-string err)
-                    ',forms))))
+(eval-and-compile
+  (defmacro trap (&rest forms)
+    "Execute FORMS without allowing errors to propagate outside."
+    (declare (indent 0)
+            (debug t))
+    `(condition-case err
+        ,(if (cdr forms) (cons 'progn forms) (car forms))
+       (error (message "Error (trapped): %s in %s"
+                      (error-message-string err)
+                      ',forms)))))
 
 ;; Configuration reading.
 
@@ -677,8 +678,8 @@ With a prefix argument, clear the designated window."
   "Display function to use the designated window."
   (prog1 mdw-designated-window
     (when mdw-designated-window
-      (select-window mdw-designated-window)
-      (switch-to-buffer buffer nil t))
+      (with-selected-window mdw-designated-window
+       (switch-to-buffer buffer nil t)))
     (setq mdw-designated-window nil)))
 
 (setq display-buffer-base-action
@@ -5205,6 +5206,11 @@ rather than baking the list into the function."
                      nil))))
 (setq magit-display-buffer-function 'mdw-display-magit-buffer)
 
+(defun mdw-display-magit-file-buffer (buffer)
+  "Show a file buffer from a diff."
+  (select-window (display-buffer buffer)))
+(setq magit-display-file-buffer-function 'mdw-display-magit-file-buffer)
+
 ;;;--------------------------------------------------------------------------
 ;;; GUD, and especially GDB.