[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/markdown-mode cc484ed 1/2: feat : auto reset `sh-shell' va
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/markdown-mode cc484ed 1/2: feat : auto reset `sh-shell' var in direct buf |
Date: |
Wed, 28 Jul 2021 03:57:17 -0400 (EDT) |
branch: elpa/markdown-mode
commit cc484ed80c5cea45dbbe34322b3eaf73058b6833
Author: liuyinz <cheunghsu@outlook.com>
Commit: liuyinz <cheunghsu@outlook.com>
feat : auto reset `sh-shell' var in direct buf
fix : add declare for var sh-set-shell
Add CHANGES.md
fix : handle "shell" & "screen" specially
fix : add restrictions on auto set shell type
fix : change bug to improvement
---
CHANGES.md | 1 +
markdown-mode.el | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/CHANGES.md b/CHANGES.md
index a160a8e..e711beb 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -42,6 +42,7 @@
name for `C-m`.
- Give `markdown-table-at-point-p-function` a non-nil default.
Simplify `markdown-table-at-point-p` accordingly.
+ - Auto set `sh-shell` when `markdown-edit-code-block` enter indirect
buffer with `sh-mode`
* Bug fixes:
- Fix issue with `nil` being returned from
`markdown-imenu-create-nested-index` [GH-578][]
diff --git a/markdown-mode.el b/markdown-mode.el
index a7ff742..70ed9b0 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -47,8 +47,10 @@
(defvar jit-lock-end)
(defvar flyspell-generic-check-word-predicate)
(defvar electric-pair-pairs)
+(defvar sh-ancestor-alist)
(declare-function project-roots "project")
+(declare-function sh-set-shell "sh-script")
;;; Constants =================================================================
@@ -8784,6 +8786,15 @@ at the END of code blocks."
(lambda (_parent-buffer _beg _end)
(funcall mode)))
(indirect-buf (edit-indirect-region begin end
'display-buffer)))
+ ;; reset `sh-shell' when indirect buffer
+ (when (and (not (member system-type '(ms-dos windows-nt)))
+ (member mode '(shell-script-mode sh-mode))
+ (member lang (append
+ (mapcar (lambda (e) (symbol-name (car
e)))
+ sh-ancestor-alist)
+ '("csh" "rc" "sh"))))
+ (with-current-buffer indirect-buf
+ (sh-set-shell lang)))
(when (> indentation 0) ;; un-indent in edit-indirect buffer
(with-current-buffer indirect-buf
(indent-rigidly (point-min) (point-max) (- indentation)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/markdown-mode cc484ed 1/2: feat : auto reset `sh-shell' var in direct buf,
ELPA Syncer <=