write function ive wanted for a long time
authorIan Kelling <ian@iankelling.org>
Thu, 13 Apr 2017 09:57:58 +0000 (02:57 -0700)
committerIan Kelling <ian@iankelling.org>
Thu, 13 Apr 2017 09:57:58 +0000 (02:57 -0700)
my-init.org

index fa7c72f8eb9537681736a3cde2af659e60e44f6e..107249901db55d0d9498c08fcc7cd541fb943bd7 100644 (file)
@@ -5293,8 +5293,9 @@ join lines
 #+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))
@@ -5313,7 +5314,17 @@ copy-variable
      (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-/