emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Update filename history after several actions


From: Christoph Conrad
Subject: Update filename history after several actions
Date: Tue, 13 Sep 2005 18:58:49 +0200

In GNU Emacs 22.0.50.1 (i686-pc-linux-gnu)
 of 2005-09-12 on brabbelbox
X server distributor `The XFree86 Project, Inc', version 11.0.40300001
configured using `configure  'CC=ccache gcc''

Several interactive file loading actions don't leave an entry in
file-name-history, so i wrote several workarounds to do that. Would be
nice if this would be customizable within emacs. The workarounds are not
perfect, e.g. dnd-open-local-file-history does not check whether the
file exists. So this are examples (that work for me), not ready to use
code for emacs.

;; update file-name-history after loading a file with recentf-buffer
(defadvice recentf-open-files-in-simply-buffer-action
  ( before recentf-open-files-in-simply-buffer-action-history act )
  (setq file-name-history (cons (widget-value widget) file-name-history)))

;; update file-name-history after loading a file with the gnuclient
;; uses gnuclient(w)
(eval-after-load "gnuserv"
  '(defadvice server-find-file( after server-find-file-update act )
     (setq file-name-history (cons (ad-get-arg 0) file-name-history))))

;; update file-name-history after loading a file with dired
(eval-after-load "dired"
  '(defadvice dired-find-file( around dired-find-file-history act )
     (let ((file (dired-get-file-for-visit)))
       ad-do-it
       (setq file-name-history (cons file file-name-history)))))

;; update file-name-history after loading a file with drag-n-drop (dnd)
(eval-after-load "dnd"
  '(defadvice dnd-open-local-file( around dnd-open-local-file-history act )
     (let ((file (dnd-get-local-file-name uri t)))
       ad-do-it
       (setq file-name-history (cons file file-name-history)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]