Edited at

recentf-save-list から呼ばれる write-region のメッセージを出力させない方法は?

More than 5 years have passed since last update.

"Wrote " とミニバッファに表示されるのがウザいので、以下

の方法を試しました。write-region 自体が呼ばれないようで、うまくい

きません。どこが間違っているのでしょうか?

;;;

;;; 方法1
;;;

(require 'cl)

(fset 'original-write-region (symbol-function 'write-region))

(defadvice recentf-save-list
(around no-message activate)
(flet ((write-region (start end filename &optional append visit lockname mustbenew)
(original-write-region start end filename append 'nomsg lockname mustbenew)))
ad-do-it))

;;;
;;; 方法2
;;;

(fset 'original-write-region (symbol-function 'write-region))

(defun my-write-region-nomsg (start end filename &optional append
visit lockname mustbenew)
(original-write-region start end filename append 'nomsg lockname mustbenew))

(defadvice recentf-save-list
(around no-message activate)
(unwind-protect
(progn
(fset 'write-region (symbol-function 'my-write-region-nomsg))
ad-do-it)
(fset 'write-region (symbol-function 'original-write-region))))