.emacs-my
changeset 1545 d77b6bb30ea4
parent 1544 2e84ca7e2578
child 1546 4939c41ef080
equal deleted inserted replaced
1544:2e84ca7e2578 1545:d77b6bb30ea4
   552         (setq table nil)
   552         (setq table nil)
   553         ) )
   553         ) )
   554     path
   554     path
   555     ))
   555     ))
   556 
   556 
       
   557 (defun my-shell-quote-argument (arg)
       
   558   (cond
       
   559    ((string-match "[<>&|* \"()[]" arg)
       
   560     (concat "'" arg "'"))
       
   561    ((string-match "'" arg)
       
   562     (concat "\"" arg "\""))
       
   563    (t
       
   564     arg)))
       
   565 
   557 ;; Activate Cygwin for native Windows Emacs if available.
   566 ;; Activate Cygwin for native Windows Emacs if available.
   558 (when (eq system-type 'windows-nt)
   567 (when (eq system-type 'windows-nt)
   559   (ignore-errors
   568   (ignore-errors
   560     (require 'cygwin-mount)
   569     (require 'cygwin-mount)
   561     (cygwin-mount-activate))
   570     (cygwin-mount-activate))
   562   (add-hook 'find-file-hook 'follow-cygwin-symlink)
   571   (add-hook 'find-file-hook 'follow-cygwin-symlink)
   563   ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument'
   572   ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument'
   564   ;; quoted by double '\' chars this cause failure.
   573   ;; quoted by double '\' chars this cause failure.
   565   (defun shell-quote-argument (argument)
   574   (advice-add #'shell-quote-argument :override #'my-shell-quote-argument)
   566     (concat "'" argument "'"))
       
   567   ;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
   575   ;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
   568   (setq null-device "/dev/null")
   576   (setq null-device "/dev/null")
   569   ;; Use shell from Cygwin/MinGW.
   577   ;; Use shell from Cygwin/MinGW.
   570   (setq shell-file-name "bash")
   578   (setq shell-file-name "bash")
   571   (setenv "SHELL" "/bin/bash")
   579   (setenv "SHELL" "/bin/bash")