tag:blogger.com,1999:blog-3669809752172683097.post1205746550132626479..comments2024-02-08T04:04:28.385-08:00Comments on Cyclopedia Square: My c-x c-s Muscles Are Getting Tired.Bryanhttp://www.blogger.com/profile/11394436715172971234noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-3669809752172683097.post-3328408854631974482008-01-31T21:24:00.000-08:002008-01-31T21:24:00.000-08:00Thanks a lot; I have tried your solution for a whi...Thanks a lot; I have tried your solution for a while now and it seems to work perfectly.<BR/><BR/>[It was "terrible" without the (if (buffer-file-name), where it would start prompting on scratch buffers, completion buffers, even the minibuffer. With your modification, it works well.]Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3669809752172683097.post-79659676570330361742008-01-25T11:42:00.000-08:002008-01-25T11:42:00.000-08:00I didn't think your solution was *terrible*. Just...I didn't think your solution was *terrible*. Just needed a little tweaking (unless I'm missing something...am I?).<BR/><BR/>I'm trying this out for now (also posted on <A HREF="http://emacswiki.org/cgi-bin/wiki?action=browse;id=AutoSave" REL="nofollow">the wiki</A>):<BR/><BR/> (defun save-buffer-if-visiting-file (&optional args)<BR/> "Save the current buffer only if it is visiting a file"<BR/> (interactive)<BR/> (if (buffer-file-name)<BR/> (save-buffer args)))<BR/><BR/> (add-hook 'auto-save-hook 'save-buffer-if-visiting-file)<BR/><BR/>Seems to do the trick so far.<BR/><BR/>I haven't tried the run-with-idle-timer suggested on the wiki. Seems like, since auto-save is already running on a timer that piggy-backing off of that is better. I could be wrong.Bryanhttps://www.blogger.com/profile/11394436715172971234noreply@blogger.comtag:blogger.com,1999:blog-3669809752172683097.post-70172364038204533452008-01-24T22:16:00.000-08:002008-01-24T22:16:00.000-08:00Yeah, I think I spoke too soon too :)This solution...Yeah, I think I spoke too soon too :)<BR/><BR/>This solution is *terrible*, sorry.<BR/><BR/>I think there might be a way to check buffer-file-name and run the hook only then; I'll have to try. I'll tell you if I find a solution!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3669809752172683097.post-62250227038486244442008-01-24T15:56:00.000-08:002008-01-24T15:56:00.000-08:00Hmm, I might have spoken a little too soon. If yo...Hmm, I might have spoken a little too soon. If you are in, say, your *scratch* buffer and you have modified it (just type something there), when auto-save time comes, it asks you what file you want to save in. Is there some way to tell it to only save buffers that are visiting files?Bryanhttps://www.blogger.com/profile/11394436715172971234noreply@blogger.comtag:blogger.com,1999:blog-3669809752172683097.post-22835976212076541852008-01-24T15:51:00.000-08:002008-01-24T15:51:00.000-08:00I tried the auto-save-visited-file-name route too,...I tried the auto-save-visited-file-name route too, and yes, that just doesn't work. The auto-save-hook does the trick though. Thanks!!Bryanhttps://www.blogger.com/profile/11394436715172971234noreply@blogger.comtag:blogger.com,1999:blog-3669809752172683097.post-85384778846094975562008-01-22T14:30:00.000-08:002008-01-22T14:30:00.000-08:00Yeah, I have been wanting this for a long time too...Yeah, I have been wanting this for a long time too. I finally decided to do something about it, and found the <I>auto-save-visited-file-name</I> variable which is claimed to work but doesn't in any usable way, and decided to use <I>(add-hook 'auto-save-hook 'save-buffer)</I>. It seems to work fine.Anonymousnoreply@blogger.com