Comments (7)
Just wanted to add that another mode that this interferes with is shell-modes (e.g. in vterm
), where Ctrl-r
is used to search history.
from ctrlf.
Making the mode per-buffer is a fine solution. I would be fine with adding a denylist of major/minor modes by default to CTRLF. Regarding the Isearch interface functions, is it sufficient for compatibility to call those instead of re-search-forward
and re-search-backward
? Does the highlighting also need to change?
from ctrlf.
I think buffer-local is the easiest thing to do now. I looked a bit more into the code pdf-iseach
uses to redefine how searches are done and it also involves things like setting state when starting and quitting, isearch-push-state-function
. And there doesn't really seem to be a simple forward
and backward
function, maybe the redefined isearch-search-fun-function
is supposed to take care of both. It also seems like pdf-iseach-search-function
is very dependent on isearch. I couldn’t find documentation of how this works beyond looking through the code, but it seems it would be too much extra stuff to add to ctrlf for little gain.
from ctrlf.
I see... unfortunately Isearch doesn't run into this problem because it's allowed to stick itself into global-map
. I don't think we can get away with that, so perhaps a denylist is the best option.
There is of course also the horrifying hack solution of defining an extended menu item for the CTRLF keybinding which provides a filter function that let-binds ctrlf-mode
back to nil and then does a key lookup to see if C-r
would resolve to isearch-backward
and only substituting with ctrlf-literal-backward
in that case. But I do think that is quite a bit too horrifying.
from ctrlf.
I've come up with a more robust keymapping scheme. It's a bit of a hack but should address the conflicting needs of these various bug reports. My new solution should solve #51, #52, #67, and #80 simultaneously while also working with remap
bindings. I have tested it a bit and it seems to work, but I don't actually use most of the modes that have been mentioned in these issue reports, so I could use some help to confirm if the bug is resolved for all of them.
from ctrlf.
Hi, checking out the changes in ddfbc35, I still think that ctrlf needs to be disabled in pdf-view, since the remapping will remap isearch-forward
etc. which is the command that should be invoked, but whose behaviour is changed in pdf-isearch-minor-mode
(as discussed above).
This works well though:
(add-hook 'pdf-isearch-minor-mode-hook (lambda () (ctrlf-local-mode -1)))
The question is if a deny-list should be implemented. Something simple like:
(defun ctrlf-disable-local-mode ()
"Unconditionally disable ‘ctrlf-local-mode’."
(ctrlf-local-mode -1))
(defcustom ctrlf-deny-mode-hooks
'(pdf-isearch-minor-mode-hook
Info-mode-hook)
"List of mode hooks where ctrlf should be disabled."
:type '(repeat variable))
;; where should this be done?
(dolist (hook ctrlf-deny-mode-hooks)
(add-hook hook #'ctrlf-disable-local-mode))
It’s no problem to write to a hook variable that is not defined, so no need to check if the mode is loaded or anything.
from ctrlf.
Gotcha. Yes, that makes sense.
Honestly, thinking about the implications of load order and all that, I'd suggest not having a user option for this, and just putting the add-hook
declarations individually into ctrlf.el
(perhaps all wrapped in a check on a boolean user option, so that it can be disabled if absolutely necessary for some reason). Then, if you want to override a default, you can either just add-hook
yourself, or you can remove-hook
one of the existing ones.
from ctrlf.
Related Issues (20)
- Lacks isearch-query-replace HOT 5
- Can it support wgrep in occur mode? HOT 1
- Question: How to add Chinese pinyin support? HOT 1
- Doesn't honor search-invisible HOT 1
- C-g behaves like RET HOT 4
- first character is not deleted HOT 9
- moving the mark back into the main buffer leaves things in a goofy state HOT 4
- Renaming default branch from 'master' to 'main' HOT 1
- C-r wrong HOT 2
- Don't jump to invisible text HOT 1
- Does not open up org mode folded headings HOT 2
- How do I customise `ctrlf-minibuffer-bindings` in my config? HOT 2
- Expose match count/index for modeline segments? HOT 1
- C-s and C-r doesn't always search the next or previous occurrence. HOT 2
- Other messages in minibuffer HOT 5
- Does not work in specific special buffer HOT 1
- Go to next match after "ending" search HOT 5
- No isearch-esque unprettifying while searching HOT 2
- Mention isearch-mb in the readme HOT 1
- isearch-repeat-forward? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ctrlf.