From 017708e9dd7509011f5df38409c489240a773eea Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 18 Jan 2003 20:42:47 +0000 Subject: [PATCH] (sh-indent-line): Use indent-line-to. (sh-non-closing-paren): New const. (sh-case, sh-while-getopts): Use it to make props non-sticky. (sh-add-completer): Use test-completion. --- lisp/ChangeLog | 84 +++++++++++++++++++++++-------------- lisp/progmodes/sh-script.el | 39 ++++++++--------- 2 files changed, 69 insertions(+), 54 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0c4a5902409..caa1b8d5dfd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2003-01-18 Stefan Monnier + + * progmodes/sh-script.el (sh-indent-line): Use indent-line-to. + (sh-non-closing-paren): New const. + (sh-case, sh-while-getopts): Use it to make props non-sticky. + (sh-add-completer): Use test-completion. + 2003-01-18 Vasily Korytov (tiny change) * progmodes/cperl-mode.el: Don't make faces depend on window-system. @@ -6,10 +13,14 @@ * cus-edit.el (customize-changed-options): Undo last doc change. +2003-01-17 Stefan Monnier + + * skeleton.el (skeleton-internal-list, skeleton-internal-1): + Don't treat \n specially in sub-skeletons. + 2003-01-17 Dave Love - * international/ucs-tables.el: Redo 8859-6 change in the right - place. + * international/ucs-tables.el: Redo 8859-6 change in the right place. 2003-01-17 Kenichi Handa @@ -25,6 +36,11 @@ * term/mac-win.el: Require fontset and call setup-default-fontset. +2003-01-16 Stefan Monnier + + * textmodes/fill.el (fill-region-as-paragraph): Only erase `hard' + property until end-of-paragraph. + 2003-01-16 Kenichi Handa * international/ucs-tables.el: Undo the last change. @@ -44,8 +60,8 @@ 2003-01-15 John Wiegley - * eshell/em-hist.el (eshell-save-history-on-exit): Renamed - `eshell-ask-to-save-history' to `eshell-save-history-on-exit', + * eshell/em-hist.el (eshell-save-history-on-exit): + Rename `eshell-ask-to-save-history' to `eshell-save-history-on-exit', because the former name is somewhat unrelated to the variables' possible values. @@ -55,8 +71,7 @@ * calc/*: Ditto. - * calc/calc.el (calc-bug-address): Change address to - deego@gnufans.org + * calc/calc.el (calc-bug-address): Change address to deego@gnufans.org. 2003-01-15 Andrew Innes @@ -79,10 +94,17 @@ 2003-01-15 YAMAMOTO Mitsuharu (tiny change) * international/mule.el (optimize-char-coding-system-table): - Optimize it. + Optimize it. * term/mac-win.el: Setup the fontset "fontset-mac" correctly. +2003-01-14 Stefan Monnier + + * pcvs-info.el (cvs-fileinfo-from-entries): Deal with Solaris' + occasional use of "05" rather than " 5" for day-of-month. + + * log-view.el (log-view-message-re): The rev might be locked. + 2003-01-14 Nick Roberts * gdb-ui.el: Improve commentary. @@ -134,11 +156,11 @@ 2003-01-14 Kim F. Storm * ido.el: Doc fixes. - (ido-max-file-prompt-width): Renamed from ido-max-prompt-path. - (ido-rewrite-file-prompt-functions): Renamed from + (ido-max-file-prompt-width): Rename from ido-max-prompt-path. + (ido-rewrite-file-prompt-functions): Rename from ido-make-file-prompt-hook. Directory name is now in dynamic variable `dirname' (instead of `path'). - (ido-rewrite-file-prompt-rules): Renamed from + (ido-rewrite-file-prompt-rules): Rename from ido-rewrite-prompt-path-rules. (ido-make-prompt): Directory name now in `dirname' var. (ido-complete): Fix error message. @@ -151,8 +173,8 @@ 2003-01-13 Dave Love - * international/utf-16.el (mule-utf-16-be, mule-utf-16-le): Remove - pre-write-conversion. + * international/utf-16.el (mule-utf-16-be, mule-utf-16-le): + Remove pre-write-conversion. 2003-01-13 Kim F. Storm @@ -168,8 +190,8 @@ * ruler-mode.el (ruler-mode-comment-column-char) (ruler-mode-goal-column-char, ruler-mode-set-goal-column-ding-flag) (ruler-mode-mouse-current-grab-object): New variables. - (ruler-mode-comment-column-face, ruler-mode-goal-column-face): New - faces. + (ruler-mode-comment-column-face, ruler-mode-goal-column-face): + New faces. (ruler-mode-mouse-set-fill-column): Removed. (ruler-mode-mouse-grab-any-column) (ruler-mode-mouse-drag-any-column-iteration) @@ -177,17 +199,17 @@ (ruler-mode-map): [header-line down-mouse-2] Bound to `ruler-mode-mouse-grab-any-column' instead of `ruler-mode-mouse-set-fill-column'. - (ruler-mode-ruler-help-echo): Updated its value. - (ruler-mode-ruler-help-echo-when-goal-column): New help string used when - goal-column is already set. - (ruler-mode-ruler-help-echo-tab): Renamed to... + (ruler-mode-ruler-help-echo): Update its value. + (ruler-mode-ruler-help-echo-when-goal-column): New help string used + when goal-column is already set. + (ruler-mode-ruler-help-echo-tab): Rename to... (ruler-mode-ruler-help-echo-when-tab-stops): New. (ruler-mode-fill-column-help-echo, ruler-mode-comment-column-help-echo) (ruler-mode-goal-column-help-echo): New help strings. (ruler-mode-ruler): Use `ruler-mode-ruler-help-echo-when-goal-column' - instead of `ruler-mode-ruler-help-echo' if `goal-column' is set. Show - `comment-column' and `goal-column'. Echo the different help string for - each *-column characters on the ruler. + instead of `ruler-mode-ruler-help-echo' if `goal-column' is set. + Show `comment-column' and `goal-column'. Echo the different help + string for each *-column characters on the ruler. 2003-01-13 Richard M. Stallman @@ -284,7 +306,7 @@ 2003-01-09 John Wiegley - * pcomplete.el (pcomplete-termination-string): Added a variable + * pcomplete.el (pcomplete-termination-string): Add a variable for modifying the string which is inserted after a completion or expansion using pcomplete. @@ -382,7 +404,7 @@ 2003-01-05 Richard M. Stallman - * obsolete/uncompress.el: Display message that this package is obsolete. + * obsolete/uncompress.el: Display message that this pkg is obsolete. * isearch.el (isearch-repeat): Error if try to repeat search and there was no previous search. @@ -565,11 +587,9 @@ use $(lisp). (compile-calc): Fix command substitution. * cus-dep.el (generated-custom-dependencies-file): New variable. - (custom-make-dependencies): Use it instead of hardcoding - cus-load.el. + (custom-make-dependencies): Use it instead of hardcoding cus-load.el. * finder.el (generated-finder-keywords-file): New variable. - (finder-compile-keywords): Use it instead of hardcoding - finder-inf.el. + (finder-compile-keywords): Use it instead of hardcoding finder-inf.el. 2002-12-28 Richard M. Stallman @@ -588,9 +608,9 @@ 2002-12-28 Andreas Schwab - * progmodes/make-mode.el (makefile-font-lock-keywords): Highlight - automatic variable references enclosed in parens and optionally - suffixed by F or D. + * progmodes/make-mode.el (makefile-font-lock-keywords): + Highlight automatic variable references enclosed in parens and + optionally suffixed by F or D. 2002-12-27 Miles Bader @@ -886,7 +906,7 @@ 2002-12-16 Kim F. Storm - * ido.el (ido-read-file-name): Removed debug message. + * ido.el (ido-read-file-name): Remove debug message. 2002-12-16 Daniel Pfeiffer @@ -933,7 +953,7 @@ 2002-12-15 Dave Love * international/mule-cmds.el (standard-keyboard-coding-systems): - Deleted. + Delete. (set-locale-environment): Don't use it. * international/utf-8.el (ucs-mule-cjk-to-unicode) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 283fe09cea2..9dadd66be9b 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -195,6 +195,7 @@ (eval-when-compile (require 'skeleton) + (require 'cl) (require 'comint)) (require 'executable) @@ -2485,16 +2486,12 @@ If INFO is supplied it is used, else it is calculated from current line." (defun sh-indent-line () "Indent the current line." (interactive) - (let ((indent (sh-calculate-indent)) shift-amt beg end + (let ((indent (sh-calculate-indent)) (pos (- (point-max) (point)))) (when indent (beginning-of-line) - (setq beg (point)) (skip-chars-forward " \t") - (setq shift-amt (- indent (current-column))) - (unless (zerop shift-amt) - (delete-region beg (point)) - (indent-to indent)) + (indent-line-to indent) ;; If initial point was within line's indentation, ;; position after the indentation. Else stay at same point in text. (if (> (- (point-max) pos) (point)) @@ -3079,6 +3076,11 @@ This is always added to the end of the buffer." ;; You are welcome to add the syntax or even completely new statements as ;; appropriate for your favorite shell. +(defconst sh-non-closing-paren + ;; If we leave it rear-sticky, calling `newline' ends up inserting a \n + ;; that inherits this property, which then confuses the indentation. + (propertize ")" 'syntax-table sh-st-punc 'rear-nonsticky t)) + (define-skeleton sh-case "Insert a case/switch statement. See `sh-feature'." (csh "expression: " @@ -3108,16 +3110,11 @@ This is always added to the end of the buffer." ?\} > \n) (sh "expression: " > "case " str " in" \n - > (read-string "pattern: ") - (propertize ")" 'syntax-table sh-st-punc) - \n - > _ \n - ";;" \n - ( "other pattern, %s: " - > str (propertize ")" 'syntax-table sh-st-punc) \n + ( "pattern, %s: " + > str sh-non-closing-paren \n > _ \n ";;" \n) - > "*" (propertize ")" 'syntax-table sh-st-punc) \n + > "*" sh-non-closing-paren \n > _ \n resume: "esac" > \n)) @@ -3220,12 +3217,10 @@ t means to return a list of all possible completions of STRING. (cons name name))) process-environment) sh-shell-variables)))) - (cond ((null code) - (try-completion string sh-shell-variables predicate)) - ((eq code t) - (all-completions string sh-shell-variables predicate)) - ((eq code 'lambda) - (assoc string sh-shell-variables))))) + (case code + (nil (try-completion string sh-shell-variables predicate)) + (lambda (test-completion string sh-shell-variables predicate)) + (t (all-completions string sh-shell-variables predicate))))) (defun sh-add (var delta) "Insert an addition of VAR and prefix DELTA for Bourne (type) shell." @@ -3452,10 +3447,10 @@ option followed by a colon `:' if the option accepts an argument." v2 "\"$OPTARG\"") (setq v1 (cdr v1) v2 nil))) - > str "|+" str (propertize ")" 'syntax-table sh-st-punc) \n + > str "|+" str sh-non-closing-paren \n > _ v2 \n > ";;" \n) - > "*" (propertize ")" 'syntax-table sh-st-punc) \n + > "*" sh-non-closing-paren \n > "echo" " \"usage: " "`basename $0`" " [+-" '(setq v1 (point)) str '(save-excursion -- 2.39.2