What is the easiest way to open the folder containing the current file by the default explorer of the OS (e.g. explorer.exe in the case of Windows OS)?
browse-url-of-file should work when given a directory.
You could implement a command that opens the directory of the current file like this:
(defun browse-file-directory () "Open the current file's directory however the OS would." (interactive) (if default-directory (browse-url-of-file (expand-file-name default-directory)) (error "No `default-directory' to open")))
Then M-x browse-file-directory should open up the directory in your OS's file browser.
shell-command (M+!) with the default explorer program and the current folder, e.g. for MS Windows,
copy the full path to the clipboard at first:
;; you need install xsel under Linux ;; xclip has some problem when copying under Linux (defun copy-yank-str (msg &optional clipboard-only) (unless clipboard-only (kill-new msg)) (cond ;; display-graphic-p need windows 23.3.1 ((and (display-graphic-p) x-select-enable-clipboard) (x-set-selection 'CLIPBOARD msg)) (t (with-temp-buffer (insert msg) (shell-command-on-region (point-min) (point-max) (cond ((eq system-type 'cygwin) "putclip") ((eq system-type 'darwin) "pbcopy") (t "xsel -ib"))))))) (defun cp-fullpath-of-current-buffer () "copy full path into the yank ring and OS clipboard" (interactive) (when buffer-file-name (copy-yank-str (file-truename buffer-file-name)) (message "file full path => clipboard & yank ring")))