.emacs-my
changeset 731 5b6105640c0e
parent 730 995821d2a5cf
child 732 139665dd6ada
equal deleted inserted replaced
730:995821d2a5cf 731:5b6105640c0e
   283         (decode-coding-string
   283         (decode-coding-string
   284          (buffer-substring (match-end 0) (point-max))
   284          (buffer-substring (match-end 0) (point-max))
   285          'utf-16-le)
   285          'utf-16-le)
   286         0 -1)                           ; -1 for stripping final \0.
   286         0 -1)                           ; -1 for stripping final \0.
   287        ))))
   287        ))))
       
   288 
       
   289 (defun my-dos2cygwin-path (path)
       
   290   "Convert DOS path to Cygwin according to current mount table."
       
   291   (interactive (list (read-directory-name "Enter new path for PYTHONPATH: ")))
       
   292   (setq path (replace-regexp-in-string "\\\\" "/" (expand-file-name path)))
       
   293   (let ( (table cygwin-mount-table--internal) item prefix )
       
   294     (while table
       
   295       (setq item (car table))
       
   296       (setq prefix (concat "\\`" (regexp-quote (car item))))
       
   297       (setq table (cdr table))
       
   298       (when (string-match prefix path)
       
   299         (setq path (replace-regexp-in-string prefix (cdr item) path))
       
   300         (setq table nil)
       
   301         ) )
       
   302     path
       
   303     ))
   288 
   304 
   289 (when (eq system-type 'windows-nt)
   305 (when (eq system-type 'windows-nt)
   290   (ignore-errors
   306   (ignore-errors
   291     (require 'cygwin-mount)
   307     (require 'cygwin-mount)
   292     (cygwin-mount-activate)
   308     (cygwin-mount-activate)