;; main hook for my auto save
(add-hook 'auto-save-hook 'my-auto-save)
;; additional hook to try to deal with emacs not auto-saving when a buffer isn't active
-(add-hook 'window-configuration-change-hook 'my-auto-save)
+(add-hook 'window-configuration-change-hook 'my-auto-save-win)
-(defun my-auto-save ()
+;; this function from mu4e really does not like buffer saving
+(advice-add 'message-send-and-exit :before 'my-as-off)
+(advice-add 'message-send-and-exit :after 'my-as-on)
+
+;; avoid window config hook saving too much, it can
+;; get into loops in some random situations
+(setq my-auto-save-last nil)
+(defun my-auto-save-win ()
+ (unless (eq (current-buffer) my-auto-save-last)
+ (my-auto-save (current-buffer))))
+
+(defun my-auto-save (&optional last)
(when (and
my-as
(buffer-file-name)
(not (string= (buffer-file-name) "*draft*"))
(buffer-modified-p)
(not (org-src-edit-buffer-p)))
+ (setq my-auto-save-last last)
(let (message-log-max)
;; a bit of a hack to partially suppress the constant saving in the echo area
(with-temp-message ""
;; this starter kit setting is probably good
(if window-system (setq frame-title-format '(buffer-file-name "%f" ("%b"))))
-(set-terminal-coding-system 'utf-8)
-(set-keyboard-coding-system 'utf-8)
-(prefer-coding-system 'utf-8)
+
+;;(prefer-coding-system 'utf-8-unix)
;; remove ugly 3d box feature
(set-face-attribute 'mode-line nil :box nil)
#+end_src
** named commands
+*** gdb
+gdb-many-windows
*** tramp sudo
/ssh:host|sudo:host:
when in the same session, you can then do:
#+end_src
*** M-/
*** C-M-/]
-copy-variable
+copy-buffer-file-name
#+begin_src emacs-lisp
+;; haven't bound this atm, todo, maybe someday?
(defun copy-variable (variable)
(interactive
(let ((v (variable-at-point))
(list (if (equal val "")
v (intern val)))))
(kill-new (symbol-value variable)))
-(global-set-key (kbd "C-M-/") 'copy-variable)
+
+(defun copy-buffer-file-name ()
+ (interactive)
+ (kill-new
+ (cond
+ ((derived-mode-p 'mu4e-view-mode) (mu4e-message-field-at-point :path))
+ (t buffer-file-name))
+ ))
+
+(global-set-key (kbd "C-M-/") 'copy-buffer-file-name)
+
#+end_src
*** C-S-/