Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like using recentf mode in Emacs which produces a list of files I have recently opened. This list is persistent between sessions, so I can get to files I used a fairly long time ago.

However, I recently started using Emacsclient to connect to an Emacs server which is automatically turned on when I log it. Overall, this was a big improvement. However, recentf mode started missing most of the files I opened whenever I restarted my computer. It remembers some of them, and I cannot see a pattern in which files get recorded.

How can I fix this behavior? How can I get it to record all the files I visit and remember them between sessions?

share|improve this question

I was having this exact same problem, and I solved it by making two changes. First following this post, I created a function to automatically invoke recentf-save-list on a timer. Thus every few minutes, we automatically re-write the ~/.recentf file.

The other thing I did was to add a shutdown script to my display manager (lightdm) that gracefully closed the emacs server every time I logout or shutdown. The way you do this will depend on your display manager, but my script simply looks like

#!/bin/bash
emacsclient -e "(save-buffers-kill-emacs)"

It would also be nice to have a hook that automatically re-ran recentf-save-list every time a client "disconnected" from the server, but I couldn't figure out the proper hooks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                       <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\n                </div>\n            </div>\n\n            <div id=\"copyright\">\n                site design / logo &#169; 2016 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\n            </div>\n            <div id=\"svnrev\">\n                rev 2016.2.9.3241\n            </div>\n                <div id=\"additional-notices\">\n                    Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group. <br>This site is not affiliated with Linus Torvalds or The Open Group in any way.\n "], "copyright__copyright__copyright": ["lay manager, but my script simply looks like\n\n#!/bin/bash\nemacsclient -e \"(save-buffers-kill-emacs)\"\n\nIt would also be nice to have a hook that automatically re-ran recentf-save-list every time a client \"disconnected\" from the server, but I couldn't figure out the proper hooks.\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}