SHARE
TWEET

In Emacs, how to insert file name in shell-command

a guest Feb 26th, 2012 35 Never
  1. (define-key minibuffer-local-map
  2.   [f3] (lambda () (interactive)
  3.        (insert (buffer-name (current-buffer-not-mini)))))
  4.  
  5. (defun current-buffer-not-mini ()
  6.   "Return current-buffer if current buffer is not the *mini-buffer*
  7.   else return buffer before minibuf is activated."
  8.   (if (not (window-minibuffer-p)) (current-buffer)
  9.       (if (eq (get-lru-window) (next-window))
  10.           (window-buffer (previous-window)) (window-buffer (next-window)))))
  11.        
  12. (define-key minibuffer-local-map
  13.   [f3] (lambda () (interactive) (insert (buffer-name))))
  14.        
  15. (define-key minibuffer-local-map [f3]
  16.   (lambda () (interactive)
  17.      (insert (buffer-name (window-buffer (minibuffer-selected-window))))))
  18.        
  19. (require 'shell)
  20. (define-key minibuffer-local-map (kbd "C-i") 'comint-dynamic-complete)
  21.        
  22. (define-key minibuffer-local-map [f3]
  23.   (lambda() (interactive) (insert (buffer-file-name (nth 1 (buffer-list))))))
RAW Paste Data
Top