kawabata / helm-chrome

Helm interface for Chrome bookmarks
21 stars 4 forks source link

Bookmarks file probing fails on Windows #8

Closed piyo closed 8 years ago

piyo commented 8 years ago

Thanks for creating this module.

Because the probing code in (defcustom helm-chrome-file ...) looks for "~/AppData/Local/Google/Chrome/User Data/Default/Bookmarks", it will fail when %HOME% is not defined or is different from %USERPROFILE%. %HOME% is an optional envvar for Windows users. It is true that many Emacs users define %HOME% for convenience.

Please consider redefining the probing code as follows:

(use-package helm-chrome
  :init
  (setq helm-chrome--file-candidates
        '(;; Linux (xdg)
          "~/.config/chromium/Default/Bookmarks"
          "~/.config/google-chrome/Default/Bookmarks"
          ;; Mac
          "~/Library/Application Support/Google/Chrome/Default/Bookmarks"
          ;; Windows 7 and above
          "$LOCALAPPDATA/Google/Chrome/User Data/Default/Bookmarks"
          ;; Windows XP
          "$USERPROFILE/Local Settings/Application Data/Google/Chrome/User Data/Default/Bookmarks"
          ))
  (setq helm-chrome-file
        (car
         (cl-delete-if-not
          'file-exists-p
          (cl-mapcar 'substitute-in-file-name
                     helm-chrome--file-candidates)))))
kawabata commented 8 years ago

Thanks! I've updated.

On Wed, Dec 23, 2015 at 2:23 AM, piyo notifications@github.com wrote:

Thanks for creating this module

Because the probing code in (defcustom helm-chrome-file ) looks for "~/AppData/Local/Google/Chrome/User Data/Default/Bookmarks", it will fail when %HOME% is not defined or is different from %USERPROFILE% %HOME% is an optional envvar for Windows users It is true that many Emacs users define %HOME% for convenience

Please consider redefining the probing code as follows:

(use-package helm-chrome :init (setq helm-chrome--file-candidates '(;; Linux (xdg) "~/config/chromium/Default/Bookmarks" "~/config/google-chrome/Default/Bookmarks" ;; Mac "~/Library/Application Support/Google/Chrome/Default/Bookmarks" ;; Windows 7 and above "$LOCALAPPDATA/Google/Chrome/User Data/Default/Bookmarks" ;; Windows XP "$USERPROFILE/Local Settings/Application Data/Google/Chrome/User Data/Default/Bookmarks" )) (setq helm-chrome-file (car (cl-delete-if-not 'file-exists-p (cl-mapcar 'substitute-in-file-name helm-chrome--file-candidates)))))

— Reply to this email directly or view it on GitHub https://github.com/kawabata/helm-chrome/issues/8.


川幡 太一 (KAWABATA, Taichi) E-mail: kawabata.taichi@gmail.com

piyo commented 8 years ago

Thank you for your consideration. I saw the commit.

As I showed, it is necessary to also use the substitute-in-file-name function in order to evaluate the variable substitution (dollar sign ("$") syntax. "~" seems to be already handled.

piyo commented 8 years ago

As a reference I will copy this here. https://en.wikipedia.org/wiki/Environment_variable#Default_Values_on_Microsoft_Windows

kawabata commented 8 years ago

Thanks for your info. Fixed it.

On Wed, Dec 23, 2015 at 9:04 AM, piyo notifications@github.com wrote:

As a reference I will copy this here.

https://en.wikipedia.org/wiki/Environment_variable#Default_Values_on_Microsoft_Windows

— Reply to this email directly or view it on GitHub https://github.com/kawabata/helm-chrome/issues/8#issuecomment-166765597.


川幡 太一 (KAWABATA, Taichi) E-mail: kawabata.taichi@gmail.com