Comments (7)
@hrehfeld as far as I can tell, you're experiencing a problem with CSS mode and desktop.el when you have dtrt-indent active? (I made a quick test, of opening a CSS file, quitting Emacs and restarting; the css-mode buffer was loaded fine by desktop.el with no error.) That's not the same as this issue (which was a request for SMIE support), so please file a new issue, with a way to repro and some evidence that the problem is caused by dtrt.
from dtrt-indent.
In fact, this would be trivial. All you need to do is detect if SMIE is supported and fire off a (smie-config-guess)
.
Here's a snippet from my init.el
:
(defun smie-auto-guess ()
(when (featurep 'smie)
(unless (eq smie-grammar 'unset)
(smie-config-guess))))
(add-hook 'after-change-major-mode-hook 'smie-auto-guess)
from dtrt-indent.
I believe this now works: dtrt-indent-find-file-hook
now uses smie-config-guess
if SMIE is available and the mode supports it. I have tested this with sh-mode
(for bug #31), but would appreciate some confirmation that it works before I make a new release.
Thanks @PythonNut for the bug report and example code.
from dtrt-indent.
Thanks @rrthomas ! I've also tested it with sh-mode and it works fine for me.
TBH, I don't understand how smie
works. Let's take the following file as an example:
test_function() {
if test; then
echo lol
fi
}
Indentation works fine with your recent changes, but sh-basic-offset
and sh-indentation
are set to 2
(and not 4
). I guess smie
uses a different variable for this. Let's say I want to change the indentation from 4
to 2
and indent-region
the whole buffer. How can I do that? Changing sh-indentation
, sh-basic-offset
and smie-indent-basic
make no difference.
from dtrt-indent.
Thanks for confirming. Good luck sussing out SMIE; I don't know much about it either.
from dtrt-indent.
I still run into this, whenever a css-mode file is in the desktop file -- seems related. Reopen?
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
smie-next-sexp(#f(compiled-function () #<bytecode 0xd5cec9>) #f(compiled-function (n) #<bytecode 0x1b0d2f9>) #<subr car> #f(compiled-function (x) "Return the car of the cdr of X." #<bytecode 0x1a49b3>) "}")
smie-backward-sexp("}")
smie-indent-keyword()
run-hook-with-args-until-success(smie-indent-keyword)
smie-indent-calculate()
smie-config--get-trace()
smie-config--guess(1 6439)
smie-config-guess()
dtrt-indent-mode(t)
(lambda nil (dtrt-indent-mode t))()
run-hooks(change-major-mode-after-body-hook prog-mode-hook css-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook css-mode-hook))
run-mode-hooks(css-mode-hook)
css-mode()
set-auto-mode-0(css-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil nil)
find-file-noselect-1(#<buffer style.css> "style.css" :nowarn nil "style.css" (1738062 66309))
find-file-noselect("style.css" :nowarn)
desktop-restore-file-buffer("style.css" "style.css" nil)
desktop-create-buffer(208 "style.css" "style.css" css-mode nil 1 (nil nil) nil nil ((tab-width . 4) (indent-tabs-mode . t) (buffer-display-time) (buffer-file-coding-system . utf-8-unix)) ((mark-ring nil)))
eval-buffer(#<buffer *load*> nil ".desktop" nil t) ; Reading at buffer position 140676
load-with-code-conversion(".desktop" ".desktop" t t)
load(".desktop" t t t)
desktop-read()
from dtrt-indent.
Will try, but time is limited atm, currently i'm just not using dtrt-indent on css-mode as a quick workaround.
from dtrt-indent.
Related Issues (20)
- Wrong indentation in shell-mode HOT 4
- 1/253 relevant lines HOT 5
- dtrt-indent-try-set-offset doesn't set generic indent variables HOT 1
- check adjacent-files like vim-sleuth HOT 2
- Advice is active regardless of whether the mode is active HOT 5
- Overriding tab setting for hard tabbed file HOT 11
- do nothing when editor-config is activated HOT 4
- Issue with protobuf-mode HOT 3
- Delay for running dtrt-indent HOT 5
- Adapting tab mode to file content not working HOT 7
- Add guess-style to related work section of readme
- Support for different js-mode offset variables HOT 5
- How to install this? HOT 3
- Feature request: Infer additional variable in web-mode
- web-mode support doesn't work well for heterogeneous indent types HOT 4
- Improve analysis of files with consistent indentation where offset is guessed wrongly due to merging HOT 2
- Error while processing typescript files HOT 3
- Guess indentation for new files in a project HOT 3
- Support `typescript-ts-base-mode` and thus `tsx-ts-mode`? HOT 1
- Compilation warnings under Emacs 29.2 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 dtrt-indent.