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

ctrlf-mode is not active on startup #40

Closed
Jawabiscuit opened this issue Apr 7, 2020 · 5 comments
Closed

ctrlf-mode is not active on startup #40

Jawabiscuit opened this issue Apr 7, 2020 · 5 comments

Comments

@Jawabiscuit
Copy link

Snippet of my config:

(use-package ctrlf
  :straight (ctrlf
             :type git
             :host github
             :repo "raxod502/ctrlf")
  :config (ctrlf-mode +1)
  :bind (:map minibuffer-local-map
              ("C-r" . ctrlf-backward-literal)))
;; Not sure why
(ctrlf-mode +1)

Notice I have to activate ctrlf-mode twice to get it to stay active. Also, another issue I had was having to define "C-r" keybind again even though i-search appeared to be overridden by ctrlf, but only to get C-r's to work in the minibuffer.

@lynlevenick
Copy link

I had to (require 'map) before ctrlf-mode could complete successfully.

@raxod502
Copy link
Member

raxod502 commented Apr 8, 2020

@lynlevenick that is very puzzling given the following line of code

https://github.com/raxod502/ctrlf/blob/814291e8dbb0c31866d95ae72667e10d48057487/ctrlf.el#L37

@raxod502
Copy link
Member

raxod502 commented Apr 8, 2020

@Jawabiscuit the following init-file works for me and should be sufficient to enable all features, can you see if there is something else in your configuration interfering?

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)
(use-package ctrlf
  :straight (:host github :repo "raxod502/ctrlf")
  :defer t
  :init

  (ctrlf-mode +1))

@Jawabiscuit
Copy link
Author

@raxod502, thanks, :defer t and :init seem to do the trick. I'm not an expert at when to use init vs config so I though config should work, however I didn't think about defer.

@raxod502
Copy link
Member

raxod502 commented Apr 9, 2020

I recommend setting use-package-always-defer unless you have a very strong reason not to. The default behavior is extremely hard to predict and almost always obstructs understanding of the control flow.

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

No branches or pull requests

3 participants