* comint shell buffers autosaved to a file? @ 2018-03-27 22:00 Kevin Layer 2018-03-27 23:13 ` Andreas Schwab 0 siblings, 1 reply; 8+ messages in thread From: Kevin Layer @ 2018-03-27 22:00 UTC (permalink / raw) To: Emacs-devel [-- Attachment #1: Type: text/plain, Size: 517 bytes --] I had a long running shell session in an emacs and the emacs crashed. I was running some complex bash scripts that had failed, but I was going to look at it today. But today the emacs crashed before I did. I'd like to guard against this in the future by having the contents of my shells saved automatically into a file in ~/.emacs.d/, perhaps. I've googled and looked through the comint source and I don't see this feature. Any ideas on this? I'm willing to do some work to add it, if it's not too hard. Kevin [-- Attachment #2: Type: text/html, Size: 635 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: comint shell buffers autosaved to a file? 2018-03-27 22:00 comint shell buffers autosaved to a file? Kevin Layer @ 2018-03-27 23:13 ` Andreas Schwab 2018-03-27 23:36 ` Kevin Layer 2018-03-27 23:42 ` Kevin Layer 0 siblings, 2 replies; 8+ messages in thread From: Andreas Schwab @ 2018-03-27 23:13 UTC (permalink / raw) To: Kevin Layer; +Cc: Emacs-devel On Mär 27 2018, Kevin Layer <layer@known.net> wrote: > Any ideas on this? I'm willing to do some work to add it, if it's not too > hard. Just enable auto-save-mode. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: comint shell buffers autosaved to a file? 2018-03-27 23:13 ` Andreas Schwab @ 2018-03-27 23:36 ` Kevin Layer 2018-03-27 23:39 ` Kevin Layer 2018-03-27 23:42 ` Kevin Layer 1 sibling, 1 reply; 8+ messages in thread From: Kevin Layer @ 2018-03-27 23:36 UTC (permalink / raw) To: Andreas Schwab; +Cc: Emacs-devel [-- Attachment #1: Type: text/plain, Size: 547 bytes --] There's no file associated with a shell buffer, so where does it auto-save to? On Tue, Mar 27, 2018 at 4:13 PM, Andreas Schwab <schwab@linux-m68k.org> wrote: > On Mär 27 2018, Kevin Layer <layer@known.net> wrote: > > > Any ideas on this? I'm willing to do some work to add it, if it's not > too > > hard. > > Just enable auto-save-mode. > > Andreas. > > -- > Andreas Schwab, schwab@linux-m68k.org > GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different." > [-- Attachment #2: Type: text/html, Size: 1056 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: comint shell buffers autosaved to a file? 2018-03-27 23:36 ` Kevin Layer @ 2018-03-27 23:39 ` Kevin Layer 0 siblings, 0 replies; 8+ messages in thread From: Kevin Layer @ 2018-03-27 23:39 UTC (permalink / raw) To: Andreas Schwab; +Cc: Emacs-devel [-- Attachment #1: Type: text/plain, Size: 1006 bytes --] I see this buffer local variable: (buffer-auto-save-file-name . "/net/freon/home/layer/src/emacs/#%2Ashell%2A#8376MSi#") but I generated a lot of output in the buffer and that file doesn't exist. I'm thinking of using comint-output-filter-functions to implement this directly, so the command output is saved when it is received by emacs. On Tue, Mar 27, 2018 at 4:36 PM, Kevin Layer <layer@known.net> wrote: > There's no file associated with a shell buffer, so where does it auto-save > to? > > On Tue, Mar 27, 2018 at 4:13 PM, Andreas Schwab <schwab@linux-m68k.org> > wrote: > >> On Mär 27 2018, Kevin Layer <layer@known.net> wrote: >> >> > Any ideas on this? I'm willing to do some work to add it, if it's not >> too >> > hard. >> >> Just enable auto-save-mode. >> >> Andreas. >> >> -- >> Andreas Schwab, schwab@linux-m68k.org >> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 >> "And now for something completely different." >> > > [-- Attachment #2: Type: text/html, Size: 1952 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: comint shell buffers autosaved to a file? 2018-03-27 23:13 ` Andreas Schwab 2018-03-27 23:36 ` Kevin Layer @ 2018-03-27 23:42 ` Kevin Layer 2018-03-28 18:05 ` Kevin Layer 1 sibling, 1 reply; 8+ messages in thread From: Kevin Layer @ 2018-03-27 23:42 UTC (permalink / raw) To: Andreas Schwab; +Cc: Emacs-devel [-- Attachment #1: Type: text/plain, Size: 578 bytes --] OK, the file was created after the auto-save-interval. Thanks, I'll think about whether this is good enough. On Tue, Mar 27, 2018 at 4:13 PM, Andreas Schwab <schwab@linux-m68k.org> wrote: > On Mär 27 2018, Kevin Layer <layer@known.net> wrote: > > > Any ideas on this? I'm willing to do some work to add it, if it's not > too > > hard. > > Just enable auto-save-mode. > > Andreas. > > -- > Andreas Schwab, schwab@linux-m68k.org > GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different." > [-- Attachment #2: Type: text/html, Size: 1088 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: comint shell buffers autosaved to a file? 2018-03-27 23:42 ` Kevin Layer @ 2018-03-28 18:05 ` Kevin Layer 2018-03-29 20:34 ` Kalman Reti 0 siblings, 1 reply; 8+ messages in thread From: Kevin Layer @ 2018-03-28 18:05 UTC (permalink / raw) To: Andreas Schwab; +Cc: Emacs-devel [-- Attachment #1: Type: text/plain, Size: 2414 bytes --] I don't know if it's cool to share this here, but I wanted to in case someone else wanted to do the same, and have them save all in the same place: (defvar my-shell-auto-save-directory (expand-file-name "~/tmp/shell-auto-saves/")) ;; Make sure it exists, this is an important directory: (make-directory my-shell-auto-save-directory t) (defvar my-shell-auto-save-file-name-prefix (let ((s (system-name))) (when (string-match "\\(.*\\)\\.franz\\.com$" s) (setq s (substring s (match-beginning 1) (match-end 1)))) (format "%s-" s))) (defun my-make-shell-auto-save-file-name () (interactive) ;; debugging only (let* ((name (buffer-name)) base suffix) (when (string-match "^\\*\\(.*\\)\\*\\(<\\(.*\\)>\\)?$" name) (setq base (match-string 1 name)) (setq suffix (match-string 3 name)) (if suffix (format "%s%s%s-%s.log" my-shell-auto-save-directory my-shell-auto-save-file-name-prefix base suffix) (format "%s%s%s.log" my-shell-auto-save-directory my-shell-auto-save-file-name-prefix base))))) (defun my--around-advice--make-auto-save-file-name (orig-func) (let (fn) (cond ((and (null buffer-file-name) (or (eq 'ssh-mode major-mode) (eq 'shell-mode major-mode)) (setq fn (my-make-shell-auto-save-file-name))) fn) (t (funcall orig-func))))) (advice-add 'make-auto-save-file-name :around #'my--around-advice--make-auto-save-file-name) ;; Now, make sure auto-save-mode is on, for shell and ssh buffers: (defun my-turn-on-auto-save-mode-hook () (auto-save-mode 1)) (add-hook 'shell-mode-hook 'my-turn-on-auto-save-mode-hook t) (add-hook 'ssh-mode-hook 'my-turn-on-auto-save-mode-hook t) On Tue, Mar 27, 2018 at 4:42 PM, Kevin Layer <layer@known.net> wrote: > OK, the file was created after the auto-save-interval. Thanks, I'll think > about whether this is good enough. > > On Tue, Mar 27, 2018 at 4:13 PM, Andreas Schwab <schwab@linux-m68k.org> > wrote: > >> On Mär 27 2018, Kevin Layer <layer@known.net> wrote: >> >> > Any ideas on this? I'm willing to do some work to add it, if it's not >> too >> > hard. >> >> Just enable auto-save-mode. >> >> Andreas. >> >> -- >> Andreas Schwab, schwab@linux-m68k.org >> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 >> "And now for something completely different." >> > > [-- Attachment #2: Type: text/html, Size: 4338 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: comint shell buffers autosaved to a file? 2018-03-28 18:05 ` Kevin Layer @ 2018-03-29 20:34 ` Kalman Reti 2018-04-02 20:10 ` Juri Linkov 0 siblings, 1 reply; 8+ messages in thread From: Kalman Reti @ 2018-03-29 20:34 UTC (permalink / raw) To: Kevin Layer; +Cc: Andreas Schwab, emacs-devel [-- Attachment #1: Type: text/plain, Size: 2635 bytes --] I just c-x c-w to a filename of my own choosing. Autosaves are then #<myfilename>#. This has worked for many years in both shell and rlogin buffers. On Mar 28, 2018 2:05 PM, "Kevin Layer" <layer@known.net> wrote: I don't know if it's cool to share this here, but I wanted to in case someone else wanted to do the same, and have them save all in the same place: (defvar my-shell-auto-save-directory (expand-file-name "~/tmp/shell-auto-saves/")) ;; Make sure it exists, this is an important directory: (make-directory my-shell-auto-save-directory t) (defvar my-shell-auto-save-file-name-prefix (let ((s (system-name))) (when (string-match "\\(.*\\)\\.franz\\.com$" s) (setq s (substring s (match-beginning 1) (match-end 1)))) (format "%s-" s))) (defun my-make-shell-auto-save-file-name () (interactive) ;; debugging only (let* ((name (buffer-name)) base suffix) (when (string-match "^\\*\\(.*\\)\\*\\(<\\(.*\\)>\\)?$" name) (setq base (match-string 1 name)) (setq suffix (match-string 3 name)) (if suffix (format "%s%s%s-%s.log" my-shell-auto-save-directory my-shell-auto-save-file-name-prefix base suffix) (format "%s%s%s.log" my-shell-auto-save-directory my-shell-auto-save-file-name-prefix base))))) (defun my--around-advice--make-auto-save-file-name (orig-func) (let (fn) (cond ((and (null buffer-file-name) (or (eq 'ssh-mode major-mode) (eq 'shell-mode major-mode)) (setq fn (my-make-shell-auto-save-file-name))) fn) (t (funcall orig-func))))) (advice-add 'make-auto-save-file-name :around #'my--around-advice--make-auto-save-file-name) ;; Now, make sure auto-save-mode is on, for shell and ssh buffers: (defun my-turn-on-auto-save-mode-hook () (auto-save-mode 1)) (add-hook 'shell-mode-hook 'my-turn-on-auto-save-mode-hook t) (add-hook 'ssh-mode-hook 'my-turn-on-auto-save-mode-hook t) On Tue, Mar 27, 2018 at 4:42 PM, Kevin Layer <layer@known.net> wrote: > OK, the file was created after the auto-save-interval. Thanks, I'll think > about whether this is good enough. > > On Tue, Mar 27, 2018 at 4:13 PM, Andreas Schwab <schwab@linux-m68k.org> > wrote: > >> On Mär 27 2018, Kevin Layer <layer@known.net> wrote: >> >> > Any ideas on this? I'm willing to do some work to add it, if it's not >> too >> > hard. >> >> Just enable auto-save-mode. >> >> Andreas. >> >> -- >> Andreas Schwab, schwab@linux-m68k.org >> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 >> "And now for something completely different." >> > > [-- Attachment #2: Type: text/html, Size: 5020 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: comint shell buffers autosaved to a file? 2018-03-29 20:34 ` Kalman Reti @ 2018-04-02 20:10 ` Juri Linkov 0 siblings, 0 replies; 8+ messages in thread From: Juri Linkov @ 2018-04-02 20:10 UTC (permalink / raw) To: Kalman Reti; +Cc: Andreas Schwab, Kevin Layer, emacs-devel > I just c-x c-w to a filename of my own choosing. Autosaves are then > #<myfilename>#. This has worked for many years in both shell and rlogin > buffers. Please note that saving shell buffers to a file makes the desktop file unreadable. Looks like a bug, reported to bug#31028. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-04-02 20:10 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-03-27 22:00 comint shell buffers autosaved to a file? Kevin Layer 2018-03-27 23:13 ` Andreas Schwab 2018-03-27 23:36 ` Kevin Layer 2018-03-27 23:39 ` Kevin Layer 2018-03-27 23:42 ` Kevin Layer 2018-03-28 18:05 ` Kevin Layer 2018-03-29 20:34 ` Kalman Reti 2018-04-02 20:10 ` Juri Linkov
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.