[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/emacs-editorconfig 8a5e621265c 118/364: Avoid asking coding syst
From: |
Stefan Monnier |
Subject: |
scratch/emacs-editorconfig 8a5e621265c 118/364: Avoid asking coding system when not specified (#102) |
Date: |
Tue, 18 Jun 2024 01:40:44 -0400 (EDT) |
branch: scratch/emacs-editorconfig
commit 8a5e621265c4a5cb92876015699793f884876769
Author: 10sr <8slashes+git@gmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Avoid asking coding system when not specified (#102)
Why ?
In short: Emacs always asks which charset to use when
editorconfig-mode is enabled, .editorconfig does not exist and trying
to save files with non-ascii characters. This is an annoying behavior
so stop it.
Calling `set-buffer-file-coding-system` sets the "explicit" flag, and
it is used just before saving files.
When this flag is set but the charset is `undecided`, Emacs asks
users what charset to use for saving files with non-ascii
characters (when this flag is not set Emacs do not ask and decide
to use something automatically, `utf-8` for my environment).
This typically happens when editing files in repositories without
.editorconfig, and it is a bit annoying behavior.
This change makes this plugin not call `set-buffer-file-coding-system`
at all when neither `charset` nor `end_of_line` is provided, thus
Emacs can decide charset automatically when saving files in
repositories without .editorconfig files.
---
editorconfig.el | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/editorconfig.el b/editorconfig.el
index 6b234e3fc76..0ff3e57c252 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -176,10 +176,12 @@ yet.")
((equal charset "utf-16be") 'utf-16be)
((equal charset "utf-16le") 'utf-16le)
(t 'undecided))))
- (set-buffer-file-coding-system (merge-coding-systems
- cs
- eol)
- nil t)))
+ (unless (and (eq eol 'undecided)
+ (eq cs 'undecided))
+ (set-buffer-file-coding-system (merge-coding-systems
+ cs
+ eol)
+ nil t))))
(defun editorconfig-set-line-length (length)
- scratch/emacs-editorconfig d150069fc61 073/364: Catch error thrown from get-properties-function and display it, (continued)
- scratch/emacs-editorconfig d150069fc61 073/364: Catch error thrown from get-properties-function and display it, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig f907c968c88 075/364: Already 2016 :) Happy new year!, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 37d22c07507 076/364: Bump version to 0.7.2, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 0791fced087 083/364: Add editorconfig-exclude-modes, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 3d6df2ae193 090/364: Derive editorconfig-conf-mode from conf-unix-mode, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig b93a7964d43 096/364: Add a comment for contributors, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig eba248e638e 098/364: Fix english, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig a4d73a4470b 103/364: Bump version to 0.7.5, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig bf8bfe5f38d 105/364: Copy properties alists before using them, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 663019d341f 112/364: Print line number and its content on parse error (#95), Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 8a5e621265c 118/364: Avoid asking coding system when not specified (#102),
Stefan Monnier <=
- scratch/emacs-editorconfig 79bcc708530 120/364: Revert "Use truename for editorconfig name" (#106), Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 4e8ed00b9af 121/364: Modify defgroup tag, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 426699c7c79 133/364: Add more plugin tests, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 61911bc92d7 140/364: Fix assignment to free variable warnings, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 4cda53e796b 142/364: Add support for feature mode. (#128), Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig a3242c35afc 141/364: Update editorconfig-conf-mode lighter text, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 71fc634a96a 143/364: Set `fill-column` directly, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 12af7738a0a 145/364: Add function to open nearest .editorconfig file (#131), Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 599d3791e45 147/364: Add document about file_type_emacs property, Stefan Monnier, 2024/06/18
- scratch/emacs-editorconfig 276097b6356 151/364: Add apache-mode support (#135), Stefan Monnier, 2024/06/18