[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r112254: * lisp/progmodes/sh-script.e
From: |
Masatake YAMATO |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r112254: * lisp/progmodes/sh-script.el: Implement `sh-mode' own |
Date: |
Wed, 10 Apr 2013 02:31:17 +0900 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 112254
fixes bug: http://debbugs.gnu.org/14112
committer: Masatake YAMATO <address@hidden>
branch nick: trunk
timestamp: Wed 2013-04-10 02:31:17 +0900
message:
* lisp/progmodes/sh-script.el: Implement `sh-mode' own
`add-log-current-defun-function'.
(sh-current-defun-name): New function.
(sh-mode): Use the function.
modified:
lisp/ChangeLog
lisp/progmodes/sh-script.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-04-09 09:36:25 +0000
+++ b/lisp/ChangeLog 2013-04-09 17:31:17 +0000
@@ -1,3 +1,10 @@
+2013-04-10 Masatake YAMATO <address@hidden>
+
+ * progmodes/sh-script.el: Implement `sh-mode' own
+ `add-log-current-defun-function' (bug#14112).
+ (sh-current-defun-name): New function.
+ (sh-mode): Use the function.
+
2013-04-09 Bastien Guerry <address@hidden>
* simple.el (choose-completion-string): Fix docstring (bug#14163).
=== modified file 'lisp/progmodes/sh-script.el'
--- a/lisp/progmodes/sh-script.el 2013-03-05 17:13:01 +0000
+++ b/lisp/progmodes/sh-script.el 2013-04-09 17:31:17 +0000
@@ -353,6 +353,28 @@
:group 'sh-script
:version "20.4")
+(defun sh-current-defun-name ()
+ "Find the name of function or variable at point.
+For use in `add-log-current-defun-function'."
+ (save-excursion
+ (end-of-line)
+ (when (re-search-backward
+ (concat "\\(?:"
+ ;; function FOO
+ ;; function FOO()
+
"^\\s-*function\\s-+\\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*\\(?:()\\)?"
+ "\\)\\|\\(?:"
+ ;; FOO()
+ "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()"
+ "\\)\\|\\(?:"
+ ;; FOO=
+ "^\\([[:alpha:]_][[:alnum:]_]*\\)="
+ "\\)")
+ nil t)
+ (or (match-string-no-properties 1)
+ (match-string-no-properties 2)
+ (match-string-no-properties 3)))))
+
(defvar sh-shell-variables nil
"Alist of shell variable names that should be included in completion.
These are used for completion in addition to all the variables named
@@ -1533,6 +1555,7 @@
(setq-local skeleton-newline-indent-rigidly t)
(setq-local defun-prompt-regexp
(concat "^\\(function[ \t]\\|[[:alnum:]]+[ \t]+()[ \t]+\\)"))
+ (setq-local add-log-current-defun-function #'sh-current-defun-name)
;; Parse or insert magic number for exec, and set all variables depending
;; on the shell thus determined.
(sh-set-shell
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r112254: * lisp/progmodes/sh-script.el: Implement `sh-mode' own,
Masatake YAMATO <=