(defadvice forward-page (after mdw-fixup compile activate)
(mdw-fixup-page-position))
-;; Bug fix for markdown-mode, which breaks point positioning during
-;; `query-replace'.
-(defadvice markdown-check-change-for-wiki-link
- (around mdw-save-match activate compile)
- "Save match data around the `markdown-mode' `after-change-functions' hook."
- (save-match-data ad-do-it))
-
-;; Bug fix for `bbdb-canonicalize-address': on Emacs 24, `run-hook-with-args'
-;; always returns nil, with the result that all email addresses are lost.
-;; Replace the function entirely.
-(defadvice bbdb-canonicalize-address
- (around mdw-bug-fix activate compile)
- "Don't use `run-hook-with-args', because that doesn't work."
- (let ((net (ad-get-arg 0)))
-
- ;; Make sure this is a proper hook list.
- (if (functionp bbdb-canonicalize-net-hook)
- (setq bbdb-canonicalize-net-hook (list bbdb-canonicalize-net-hook)))
-
- ;; Iterate over the hooks until things converge.
- (let ((donep nil))
- (while (not donep)
- (let (next (changep nil)
- hook (hooks bbdb-canonicalize-net-hook))
- (while hooks
- (setq hook (pop hooks))
- (setq next (funcall hook net))
- (if (not (equal next net))
- (setq changep t
- net next)))
- (setq donep (not changep)))))
- (setq ad-return-value net)))
-
;; Transient mark mode hacks.
(defadvice exchange-point-and-mark
(with-current-buffer buffer
(set-visited-file-name to nil t)))))))
+;;;--------------------------------------------------------------------------
+;;; Miscellaneous bug fixes.
+
+;; Bug fix for markdown-mode, which breaks point positioning during
+;; `query-replace'.
+(defadvice markdown-check-change-for-wiki-link
+ (around mdw-save-match activate compile)
+ "Save match data around the `markdown-mode' `after-change-functions' hook."
+ (save-match-data ad-do-it))
+
+;; Bug fix for `bbdb-canonicalize-address': on Emacs 24, `run-hook-with-args'
+;; always returns nil, with the result that all email addresses are lost.
+;; Replace the function entirely.
+(defadvice bbdb-canonicalize-address
+ (around mdw-bug-fix activate compile)
+ "Don't use `run-hook-with-args', because that doesn't work."
+ (let ((net (ad-get-arg 0)))
+
+ ;; Make sure this is a proper hook list.
+ (if (functionp bbdb-canonicalize-net-hook)
+ (setq bbdb-canonicalize-net-hook (list bbdb-canonicalize-net-hook)))
+
+ ;; Iterate over the hooks until things converge.
+ (let ((donep nil))
+ (while (not donep)
+ (let (next (changep nil)
+ hook (hooks bbdb-canonicalize-net-hook))
+ (while hooks
+ (setq hook (pop hooks))
+ (setq next (funcall hook net))
+ (if (not (equal next net))
+ (setq changep t
+ net next)))
+ (setq donep (not changep)))))
+ (setq ad-return-value net)))
+
;;;--------------------------------------------------------------------------
;;; Window management.