all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* shell-command in Windows 7
@ 2017-04-14  8:53 42 147
  2017-04-14 17:11 ` John Mastro
  0 siblings, 1 reply; 18+ messages in thread
From: 42 147 @ 2017-04-14  8:53 UTC (permalink / raw)
  To: help-gnu-emacs

I've been using this code to create functions that open files / folders 
within Emacs in Windows 7:

(defun open-buffer-path ()
"Run explorer on the directory of the current buffer."
(interactive)
(shell-command (concat "explorer " (replace-regexp-in-string "/" "\\\\" 
(file-name-directory (buffer-file-name)) t t))))

(defun firefox ()
   (interactive)
   (shell-command (concat "explorer " (replace-regexp-in-string "/" 
"\\\\" "E:\\Program Files\\Mozilla Firefox\\firefox.exe" t t))))

This worked fine for a while. Then I erased one of my older OSes on a 
different partition and created an NTFS partition for extra Windows 7 
storage. This did not change the drive number of Windows 7 at all. But 
for some reason, after that repartitioning, the above code only works if 
I alternative between the two different directory string types. Thus if 
I had the above before, on system reboot, I have to replace it all with:

(defun .emacs-open ()
"Run explorer on the directory of the current buffer."
(interactive)
(shell-command (concat "explorer " (replace-regexp-in-string "/" "\\\\" 
"E:/Users/John/AppData/Roaming/" t t))))

And vice-versa, otherwise Emacs is unable to open the file / directory I 
want, and just opens to the same default directory when I call each 
function.  I created a workaround in which I press F12 to alternate 
between the two load files (I put these settings in a dedicated .el), 
but I'm very curious why this happens, and ideally a workaround like 
this would not be necessary.




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-04-20 23:43 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-14  8:53 shell-command in Windows 7 42 147
2017-04-14 17:11 ` John Mastro
2017-04-14 17:13   ` John Mastro
2017-04-14 17:49     ` 42 147
2017-04-14 19:48     ` 42 147
2017-04-14 20:04       ` John Mastro
2017-04-15  7:40         ` 42 147
2017-04-15  8:30           ` Eli Zaretskii
2017-04-15 10:06         ` 42 147
2017-04-15 10:19           ` Eli Zaretskii
2017-04-15 17:17         ` 42 147
2017-04-15 18:02           ` Drew Adams
2017-04-15 18:33             ` 42 147
2017-04-15 19:54               ` John Mastro
2017-04-15 20:08                 ` John Mastro
2017-04-15 21:33                   ` 42 147
2017-04-20 23:43                   ` white line appears irregularly on left side of Emacs frame in GNU / Linux virtual machine 42 147
2017-04-15  7:04       ` shell-command in Windows 7 Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.