Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default profile #6

Open
michael-heerdegen opened this issue Mar 4, 2020 · 11 comments
Open

Use default profile #6

michael-heerdegen opened this issue Mar 4, 2020 · 11 comments

Comments

@michael-heerdegen
Copy link

Hi,

when I upgrade firefox versions in Debian and restart the browser, firefox edits the file "~/.mozilla/firefox/profiles.ini" and often adds new profiles. It doesn't change the default profile but it always happens that the default profile is not listed as first in the file any more. But helm-firefox just uses the name of the first profile listed in the files to get the bookmarks. So, after upgrading firefox I always have to edit profiles.ini manually and move the profiles around so that the default profile comes first. Can helm-firefox be smarter and search for the default profile by itself?

TIA, Michael.

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Mar 4, 2020 via email

@michael-heerdegen
Copy link
Author

michael-heerdegen commented Mar 4, 2020 via email

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Mar 4, 2020 via email

@michael-heerdegen
Copy link
Author

michael-heerdegen commented Mar 4, 2020 via email

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Mar 5, 2020 via email

thierryvolpiatto pushed a commit that referenced this issue Mar 5, 2020
if needed (#6).

* helm-firefox.el (helm-firefox-bookmark-user-directory): New.
(helm-guess-firefox-bookmark-file): Use it.
@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Mar 5, 2020 via email

@michael-heerdegen
Copy link
Author

michael-heerdegen commented Mar 5, 2020 via email

@thierryvolpiatto
Copy link
Member

Does this function returns the right directory for you?

(defun helm-get-firefox-user-init-dir ()
  "Guess the default Firefox user directory name."
  (with-current-buffer
      (find-file-noselect
       (expand-file-name "profiles.ini" helm-firefox-default-directory))
    (goto-char (point-min))
    (prog1
        (cl-loop with dir
                 with atime = 0
                 while (re-search-forward "Path=" nil t)
                 for tmpdir = (buffer-substring-no-properties (point) (point-at-eol))
                 for bmkfile = (expand-file-name "bookmarks.html" tmpdir)
                 for at = (if (file-exists-p bmkfile)
                              (float-time (nth 5 (file-attributes bmkfile)))
                            (max atime 0))
                 when (> at atime)
                 do (setq dir tmpdir
                          atime at)
                 finally return (file-name-as-directory
                                 (expand-file-name dir)))
      (kill-buffer))))

@michael-heerdegen
Copy link
Author

michael-heerdegen commented Mar 6, 2020 via email

thierryvolpiatto pushed a commit that referenced this issue Mar 6, 2020
its directory (#6).

* helm-firefox.el (helm-get-firefox-user-init-dir): Do it.
@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Mar 6, 2020 via email

@michael-heerdegen
Copy link
Author

michael-heerdegen commented Mar 6, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants