Comments (3)
I've bumped into this too. I fixed it with:
(remove-hook 'find-file-hook #'crux-reopen-as-root)
Currently, opening any file that is read-only and not owned by the current user triggers a root login prompt. This occurs for viewing system files (e.g /etc/fstab
), built-in elisp libraries (e.g. simple.el.gz
) and simply viewing files owned by other users on a shared system.
This is assuming that the user wants to open the file, as root, and edit it. This isn't always true. If I don't have root on that box, it's pointless. If I just want to view an important system file, it's hazardous to open it as root as I might accidentally make changes that break things.
Changing the default behaviour of find-file like this caught me by surprise. @bbatsov what's the original intent of this feature? Could we make this opt-in, the same way crux keybindings are opt-in?
from crux.
I'm guessing something's off with the permissions of those local files.
from crux.
Hmm. I might be wrong, but have recently noticed that whenever I use M-. to jump to system installed elisp, the first load fails due to an attempt to re-open as root.
After a brief investigation I can confirm it with the following sequence:
(xref-find-definitions 'find-file) ;; asks for sudo root privileges
(kill-buffer "files.el.gz") ;; close buffer so find file will trigger again
(remove-hook 'find-file-hook 'crux-reopen-as-root)
(xref-find-definitions 'find-file) ;; jumps directly to files.el.gz with no password prompt
(kill-buffer "files.el.gz") ;; close buffer again
(add-hook 'find-file-hook 'crux-reopen-as-root) ;; re-add offending hook
(xref-find-definitions 'find-file) ;; prompts for sudo root again
I don't believe the hook should be that aggressive about re-opening as root.
from crux.
Related Issues (20)
- [Feature request] Find `.dir-locals.el` file
- crux-reopen-as-root interactive? HOT 1
- crux-move-beginning-of-line in ansi-term HOT 1
- Crux fails wiith "crux-open-with: Wrong type argument: stringp, nil" HOT 3
- write-as or "clone file" HOT 2
- crux-sudo-edit broken on emacs 27 HOT 4
- Support using non-ansi-term commands for crux-visit-term-buffer HOT 1
- Emacs shift-selection with crux-move-beginning-of-line
- crux-kill-other-buffers and special buffers HOT 1
- Cut New Release? HOT 2
- `crux-duplicate<-and-comment>-current-line-or-region` using regions blends lines HOT 2
- Move to line begin is broken. HOT 1
- Refine the keybinding advice in README.md.
- [Feature Request] Add move-line-up/down feature. HOT 1
- Get "The mark is not set now, so there is no region" when the first time open a buffer after latest restart use emacs daemon.
- [Feature Request] Add mark-lines' like feature.
- How to open files in full windows
- crux-smart-open-line-above: unexpected behavior with orgmode links
- crux-rename-file-and-buffer: move file into a different directory, without changing the filename
- crux-smart-kill-line ignores visual-line-mode HOT 1
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 crux.