aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorStephen Leake2019-09-18 17:43:28 -0700
committerStephen Leake2019-09-18 17:43:28 -0700
commit34f1035e878a06ad181ff7fc533cd1fa0a565847 (patch)
tree7708b0e62b09571ba5b2c625d810cd932c380508 /lisp/progmodes
parentb478444099655f36f7b243e21e8f98051299ca8f (diff)
parent107ce3050fc37b9a13d8304ae1bb73fac9de5f61 (diff)
downloademacs-34f1035e878a06ad181ff7fc533cd1fa0a565847.tar.gz
emacs-34f1035e878a06ad181ff7fc533cd1fa0a565847.zip
Merge commit '107ce3050fc37b9a13d8304ae1bb73fac9de5f61'
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/python.el8
-rw-r--r--lisp/progmodes/sh-script.el46
2 files changed, 32 insertions, 22 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 14b65669c4b..ec5d8c55512 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -4084,6 +4084,12 @@ JUSTIFY should be used (if applicable) as in `fill-paragraph'."
4084 (goto-char (line-end-position)))) 4084 (goto-char (line-end-position))))
4085 t) 4085 t)
4086 4086
4087(defun python-do-auto-fill ()
4088 "Like `do-auto-fill', but bind `fill-indent-according-to-mode'."
4089 ;; See Bug#36056.
4090 (let ((fill-indent-according-to-mode t))
4091 (do-auto-fill)))
4092
4087 4093
4088;;; Skeletons 4094;;; Skeletons
4089 4095
@@ -5379,7 +5385,7 @@ REPORT-FN is Flymake's callback function."
5379 (set (make-local-variable 'paragraph-start) "\\s-*$") 5385 (set (make-local-variable 'paragraph-start) "\\s-*$")
5380 (set (make-local-variable 'fill-paragraph-function) 5386 (set (make-local-variable 'fill-paragraph-function)
5381 #'python-fill-paragraph) 5387 #'python-fill-paragraph)
5382 (set (make-local-variable 'fill-indent-according-to-mode) t) ; Bug#36056. 5388 (set (make-local-variable 'normal-auto-fill-function) #'python-do-auto-fill)
5383 5389
5384 (set (make-local-variable 'beginning-of-defun-function) 5390 (set (make-local-variable 'beginning-of-defun-function)
5385 #'python-nav-beginning-of-defun) 5391 #'python-nav-beginning-of-defun)
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index aad38b94d76..cbc0ac74f09 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -112,7 +112,7 @@
112;; would make this unnecessary; simply learn the values when you visit 112;; would make this unnecessary; simply learn the values when you visit
113;; the buffer. 113;; the buffer.
114;; You can do this automatically like this: 114;; You can do this automatically like this:
115;; (add-hook 'sh-set-shell-hook 'sh-learn-buffer-indent) 115;; (add-hook 'sh-set-shell-hook #'sh-learn-buffer-indent)
116;; 116;;
117;; However... `sh-learn-buffer-indent' is extremely slow, 117;; However... `sh-learn-buffer-indent' is extremely slow,
118;; especially on large-ish buffer. Also, if there are conflicts the 118;; especially on large-ish buffer. Also, if there are conflicts the
@@ -480,7 +480,6 @@ This is buffer-local in every such buffer.")
480 (define-key map "\C-c>" 'sh-learn-buffer-indent) 480 (define-key map "\C-c>" 'sh-learn-buffer-indent)
481 (define-key map "\C-c\C-\\" 'sh-backslash-region) 481 (define-key map "\C-c\C-\\" 'sh-backslash-region)
482 482
483 (define-key map "=" 'sh-assignment)
484 (define-key map "\C-c+" 'sh-add) 483 (define-key map "\C-c+" 'sh-add)
485 (define-key map "\C-\M-x" 'sh-execute-region) 484 (define-key map "\C-\M-x" 'sh-execute-region)
486 (define-key map "\C-c\C-x" 'executable-interpret) 485 (define-key map "\C-c\C-x" 'executable-interpret)
@@ -1059,7 +1058,7 @@ subshells can nest."
1059 (when (< startpos (line-beginning-position)) 1058 (when (< startpos (line-beginning-position))
1060 (put-text-property startpos (point) 'syntax-multiline t) 1059 (put-text-property startpos (point) 'syntax-multiline t)
1061 (add-hook 'syntax-propertize-extend-region-functions 1060 (add-hook 'syntax-propertize-extend-region-functions
1062 'syntax-propertize-multiline nil t)) 1061 #'syntax-propertize-multiline nil t))
1063 ))) 1062 )))
1064 1063
1065 1064
@@ -1603,25 +1602,25 @@ with your script for an edit-interpret-debug cycle."
1603 (setq-local local-abbrev-table sh-mode-abbrev-table) 1602 (setq-local local-abbrev-table sh-mode-abbrev-table)
1604 (setq-local comint-dynamic-complete-functions 1603 (setq-local comint-dynamic-complete-functions
1605 sh-dynamic-complete-functions) 1604 sh-dynamic-complete-functions)
1606 (add-hook 'completion-at-point-functions 'comint-completion-at-point nil t) 1605 (add-hook 'completion-at-point-functions #'comint-completion-at-point nil t)
1607 ;; we can't look if previous line ended with `\' 1606 ;; we can't look if previous line ended with `\'
1608 (setq-local comint-prompt-regexp "^[ \t]*") 1607 (setq-local comint-prompt-regexp "^[ \t]*")
1609 (setq-local imenu-case-fold-search nil) 1608 (setq-local imenu-case-fold-search nil)
1610 (setq font-lock-defaults 1609 (setq font-lock-defaults
1611 '((sh-font-lock-keywords 1610 `((sh-font-lock-keywords
1612 sh-font-lock-keywords-1 sh-font-lock-keywords-2) 1611 sh-font-lock-keywords-1 sh-font-lock-keywords-2)
1613 nil nil 1612 nil nil
1614 ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil 1613 ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil
1615 (font-lock-syntactic-face-function 1614 (font-lock-syntactic-face-function
1616 . sh-font-lock-syntactic-face-function))) 1615 . ,#'sh-font-lock-syntactic-face-function)))
1617 (setq-local syntax-propertize-function #'sh-syntax-propertize-function) 1616 (setq-local syntax-propertize-function #'sh-syntax-propertize-function)
1618 (add-hook 'syntax-propertize-extend-region-functions 1617 (add-hook 'syntax-propertize-extend-region-functions
1619 #'syntax-propertize-multiline 'append 'local) 1618 #'syntax-propertize-multiline 'append 'local)
1620 (setq-local skeleton-pair-alist '((?` _ ?`))) 1619 (setq-local skeleton-pair-alist '((?` _ ?`)))
1621 (setq-local skeleton-pair-filter-function 'sh-quoted-p) 1620 (setq-local skeleton-pair-filter-function #'sh-quoted-p)
1622 (setq-local skeleton-further-elements 1621 (setq-local skeleton-further-elements
1623 '((< '(- (min sh-basic-offset (current-column)))))) 1622 '((< '(- (min sh-basic-offset (current-column))))))
1624 (setq-local skeleton-filter-function 'sh-feature) 1623 (setq-local skeleton-filter-function #'sh-feature)
1625 (setq-local skeleton-newline-indent-rigidly t) 1624 (setq-local skeleton-newline-indent-rigidly t)
1626 (setq-local defun-prompt-regexp 1625 (setq-local defun-prompt-regexp
1627 (concat 1626 (concat
@@ -2408,12 +2407,12 @@ whose value is the shell name (don't quote it)."
2408 (message "setting up indent stuff") 2407 (message "setting up indent stuff")
2409 ;; sh-mode has already made indent-line-function local 2408 ;; sh-mode has already made indent-line-function local
2410 ;; but do it in case this is called before that. 2409 ;; but do it in case this is called before that.
2411 (setq-local indent-line-function 'sh-indent-line)) 2410 (setq-local indent-line-function #'sh-indent-line))
2412 (if sh-make-vars-local 2411 (if sh-make-vars-local
2413 (sh-make-vars-local)) 2412 (sh-make-vars-local))
2414 (message "Indentation setup for shell type %s" sh-shell)) 2413 (message "Indentation setup for shell type %s" sh-shell))
2415 (message "No indentation for this shell type.") 2414 (message "No indentation for this shell type.")
2416 (setq-local indent-line-function 'sh-basic-indent-line)) 2415 (setq-local indent-line-function #'sh-basic-indent-line))
2417 (when font-lock-mode 2416 (when font-lock-mode
2418 (setq font-lock-set-defaults nil) 2417 (setq font-lock-set-defaults nil)
2419 (font-lock-set-defaults) 2418 (font-lock-set-defaults)
@@ -3586,7 +3585,7 @@ so that `occur-next' and `occur-prev' will work."
3586;; (insert ")\n") 3585;; (insert ")\n")
3587;; ))) 3586;; )))
3588;; 3587;;
3589;; (add-hook 'sh-learned-buffer-hook 'what-i-learned) 3588;; (add-hook 'sh-learned-buffer-hook #'what-i-learned)
3590 3589
3591 3590
3592;; Originally this was sh-learn-region-indent (beg end) 3591;; Originally this was sh-learn-region-indent (beg end)
@@ -4055,7 +4054,8 @@ Add these variables to `sh-shell-variables'."
4055 (goto-char (point-min)) 4054 (goto-char (point-min))
4056 (setq sh-shell-variables-initialized t) 4055 (setq sh-shell-variables-initialized t)
4057 (while (search-forward "=" nil t) 4056 (while (search-forward "=" nil t)
4058 (sh-assignment 0))) 4057 (sh--assignment-collect)))
4058 (add-hook 'post-self-insert-hook #'sh--assignment-collect nil t)
4059 (message "Scanning buffer `%s' for variable assignments...done" 4059 (message "Scanning buffer `%s' for variable assignments...done"
4060 (buffer-name))) 4060 (buffer-name)))
4061 4061
@@ -4328,20 +4328,24 @@ option followed by a colon `:' if the option accepts an argument."
4328 4328
4329 4329
4330 4330
4331(put 'sh-assignment 'delete-selection t)
4331(defun sh-assignment (arg) 4332(defun sh-assignment (arg)
4332 "Remember preceding identifier for future completion and do self-insert." 4333 "Remember preceding identifier for future completion and do self-insert."
4333 (interactive "p") 4334 (interactive "p")
4335 (declare (obsolete nil "27.1"))
4334 (self-insert-command arg) 4336 (self-insert-command arg)
4335 (if (<= arg 1) 4337 (sh--assignment-collect))
4336 (sh-remember-variable 4338
4337 (save-excursion 4339(defun sh--assignment-collect ()
4338 (if (re-search-forward (sh-feature sh-assignment-regexp) 4340 (sh-remember-variable
4339 (prog1 (point) 4341 (when (eq ?= (char-before))
4340 (beginning-of-line 1)) 4342 (save-excursion
4341 t) 4343 (if (re-search-forward (sh-feature sh-assignment-regexp)
4342 (match-string 1)))))) 4344 (prog1 (point)
4345 (beginning-of-line 1))
4346 t)
4347 (match-string 1))))))
4343 4348
4344(put 'sh-assignment 'delete-selection t)
4345 4349
4346(defun sh-maybe-here-document (arg) 4350(defun sh-maybe-here-document (arg)
4347 "Insert self. Without prefix, following unquoted `<' inserts here document. 4351 "Insert self. Without prefix, following unquoted `<' inserts here document.