Want more features on Pastebin? Sign Up, it's FREE!
Guest

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

By: a guest on Feb 26th, 2012  |  syntax: None  |  size: 0.88 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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))))))
clone this paste RAW Paste Data