unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* messages buffer history
@ 2013-01-11  0:26 drain
  2013-01-11  1:05 ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: drain @ 2013-01-11  0:26 UTC (permalink / raw)
  To: Help-gnu-emacs

How would I set the messages buffer to record the history of every folder I
have gone to in my current session?



--
View this message in context: http://emacs.1067599.n5.nabble.com/messages-buffer-history-tp274949.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: messages buffer history
  2013-01-11  0:26 messages buffer history drain
@ 2013-01-11  1:05 ` Drew Adams
  2013-01-11  2:15   ` drain
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2013-01-11  1:05 UTC (permalink / raw)
  To: 'drain', Help-gnu-emacs

> How would I set the messages buffer to record the history of 
> every folder I have gone to in my current session?

Gone to how?

Maybe option `find-file-hook' or `dired-after-readin-hook' will help you.

(But why would you want to drown that history in a sea of other, unrelated
messages?  If you want a history of accessed folders, why not put that in a
separate buffer?)




^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: messages buffer history
  2013-01-11  1:05 ` Drew Adams
@ 2013-01-11  2:15   ` drain
  2013-01-11  5:28     ` Le Wang
  0 siblings, 1 reply; 8+ messages in thread
From: drain @ 2013-01-11  2:15 UTC (permalink / raw)
  To: Help-gnu-emacs

> Gone to how?

"Accessed folders", which includes:

(1) M-x find-file RET usr/include RET
(2) M-x find-file RET ~/study/literature.org RET

> If you want a history of accessed folders, why not put that in a
>separate buffer?

Good idea. After (1) and (2), the separate buffer would read:

/usr/include
~/study




--
View this message in context: http://emacs.1067599.n5.nabble.com/messages-buffer-history-tp274949p274956.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: messages buffer history
  2013-01-11  2:15   ` drain
@ 2013-01-11  5:28     ` Le Wang
  2013-01-11  8:44       ` drain
  0 siblings, 1 reply; 8+ messages in thread
From: Le Wang @ 2013-01-11  5:28 UTC (permalink / raw)
  To: drain; +Cc: Help-gnu-emacs

On Fri, Jan 11, 2013 at 10:15 AM, drain <aeuster@gmail.com> wrote:
> (1) M-x find-file RET usr/include RET
> (2) M-x find-file RET ~/study/literature.org RET
>
>> If you want a history of accessed folders, why not put that in a
>>separate buffer?
>
> Good idea. After (1) and (2), the separate buffer would read:
>
> /usr/include
> ~/study

Emacs already tracks this information, no need to add hooks.

(defun get-session-dirs ()
  "return list of directories visited in session"
  (delete-dups
   (mapcar (lambda (f)
             (file-name-directory f))
           file-name-history)))

List of directory returned is in reverse chronological order.

-- 
Le



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: messages buffer history
  2013-01-11  5:28     ` Le Wang
@ 2013-01-11  8:44       ` drain
  2013-01-11 14:55         ` Le Wang
  2013-01-11 15:24         ` Drew Adams
  0 siblings, 2 replies; 8+ messages in thread
From: drain @ 2013-01-11  8:44 UTC (permalink / raw)
  To: Help-gnu-emacs

> List of directory returned is in reverse chronological order. 

How would I insert the returned list into a buffer?



--
View this message in context: http://emacs.1067599.n5.nabble.com/messages-buffer-history-tp274949p274979.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: messages buffer history
  2013-01-11  8:44       ` drain
@ 2013-01-11 14:55         ` Le Wang
  2013-01-11 15:24         ` Drew Adams
  1 sibling, 0 replies; 8+ messages in thread
From: Le Wang @ 2013-01-11 14:55 UTC (permalink / raw)
  To: drain; +Cc: Help-gnu-emacs

On Fri, Jan 11, 2013 at 4:44 PM, drain <aeuster@gmail.com> wrote:
>> List of directory returned is in reverse chronological order.
>
> How would I insert the returned list into a buffer?

I think it's time to crack open that Elisp tutorial you're talking about:

(defun session-dirs ()
  "return list of directories visited in session"
  (delete-dups
   (mapcar (lambda (f)
             (file-name-directory f))
           file-name-history)))

(defun display-session-dirs ()
  "show list of session dirs in a buffer"
  (interactive)
  (pop-to-buffer (get-buffer-create "*session dirs*"))
  (erase-buffer)
  (insert (mapconcat 'identity (session-dirs) "\n")))


-- 
Le



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: messages buffer history
  2013-01-11  8:44       ` drain
  2013-01-11 14:55         ` Le Wang
@ 2013-01-11 15:24         ` Drew Adams
  2013-01-11 22:33           ` drain
  1 sibling, 1 reply; 8+ messages in thread
From: Drew Adams @ 2013-01-11 15:24 UTC (permalink / raw)
  To: 'drain', Help-gnu-emacs

> > Emacs already tracks this information, no need to add hooks.
> > List of directory returned is in reverse chronological order.
> 
> How would I insert the returned list into a buffer?

And that list is only a snapshot taken at one moment.

I think the OP wanted a log, with the log being updated each time a dir is
accessed, so that it always accurately reflects the access history.

Hence the use of a hook.  That's what hooks are for.

You can use another kind of procedural attachment, or create another kind of
trigger, or even use a timer (modulo some delay in reflection).  

But some such mechanism is called for if you want to attach/couple an access
event to log output.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: messages buffer history
  2013-01-11 15:24         ` Drew Adams
@ 2013-01-11 22:33           ` drain
  0 siblings, 0 replies; 8+ messages in thread
From: drain @ 2013-01-11 22:33 UTC (permalink / raw)
  To: Help-gnu-emacs

> I think the OP wanted a log, with the log being updated each time a dir
> is accessed, so that it always accurately reflects the access history.

That is precisely what I wanted, but Le Wang's interpretation ended up
being tidier than what I had in mind.

> I think it's time to crack open that Elisp tutorial you're talking about

Indeed. Left off at car cdr & cons...



--
View this message in context: http://emacs.1067599.n5.nabble.com/messages-buffer-history-tp274949p275050.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-01-11 22:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11  0:26 messages buffer history drain
2013-01-11  1:05 ` Drew Adams
2013-01-11  2:15   ` drain
2013-01-11  5:28     ` Le Wang
2013-01-11  8:44       ` drain
2013-01-11 14:55         ` Le Wang
2013-01-11 15:24         ` Drew Adams
2013-01-11 22:33           ` drain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).