diff options
| author | Leo Liu | 2014-04-12 12:07:53 +0800 |
|---|---|---|
| committer | Leo Liu | 2014-04-12 12:07:53 +0800 |
| commit | 2e611da66e0192a8a63437dbc8f116314cadb71d (patch) | |
| tree | fd1de5233fbfbae6e0c9c86720fc54d055ae354d | |
| parent | f628e17c4b814d93b40515af62ab1dbb2ca62226 (diff) | |
| download | emacs-2e611da66e0192a8a63437dbc8f116314cadb71d.tar.gz emacs-2e611da66e0192a8a63437dbc8f116314cadb71d.zip | |
Don't break emacs <= 24.3 just yet
* progmodes/octave.el (completion-table-with-cache): Define if not
available.
(octave-goto-function-definition)
(octave-sync-function-file-names)
(octave-find-definition-default-filename): Backquote upattern for
compatibility.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/progmodes/octave.el | 50 |
2 files changed, 40 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2c5b40ef86a..6ccf81c9c35 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2014-04-12 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * progmodes/octave.el (completion-table-with-cache): Define if not | ||
| 4 | available. | ||
| 5 | (octave-goto-function-definition) | ||
| 6 | (octave-sync-function-file-names) | ||
| 7 | (octave-find-definition-default-filename): Backquote upattern for | ||
| 8 | compatibility. | ||
| 9 | |||
| 1 | 2014-04-11 Michael Albinus <michael.albinus@gmx.de> | 10 | 2014-04-11 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 11 | ||
| 3 | * net/tramp-sh.el (tramp-sh-handle-file-truename): Quote the file | 12 | * net/tramp-sh.el (tramp-sh-handle-file-truename): Quote the file |
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 123aac03eae..3fdcec219d3 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -40,7 +40,19 @@ | |||
| 40 | (unless (fboundp 'user-error) | 40 | (unless (fboundp 'user-error) |
| 41 | (defalias 'user-error 'error)) | 41 | (defalias 'user-error 'error)) |
| 42 | (unless (fboundp 'delete-consecutive-dups) | 42 | (unless (fboundp 'delete-consecutive-dups) |
| 43 | (defalias 'delete-consecutive-dups 'delete-dups))) | 43 | (defalias 'delete-consecutive-dups 'delete-dups)) |
| 44 | (unless (fboundp 'completion-table-with-cache) | ||
| 45 | (defun completion-table-with-cache (fun &optional ignore-case) | ||
| 46 | ;; See eg bug#11906. | ||
| 47 | (let* (last-arg last-result | ||
| 48 | (new-fun | ||
| 49 | (lambda (arg) | ||
| 50 | (if (and last-arg (string-prefix-p last-arg arg ignore-case)) | ||
| 51 | last-result | ||
| 52 | (prog1 | ||
| 53 | (setq last-result (funcall fun arg)) | ||
| 54 | (setq last-arg arg)))))) | ||
| 55 | (completion-table-dynamic new-fun))))) | ||
| 44 | (eval-when-compile | 56 | (eval-when-compile |
| 45 | (unless (fboundp 'setq-local) | 57 | (unless (fboundp 'setq-local) |
| 46 | (defmacro setq-local (var val) | 58 | (defmacro setq-local (var val) |
| @@ -1048,8 +1060,8 @@ directory and makes this the current buffer's default directory." | |||
| 1048 | (unless found (goto-char orig)) | 1060 | (unless found (goto-char orig)) |
| 1049 | found)))) | 1061 | found)))) |
| 1050 | (pcase (and buffer-file-name (file-name-extension buffer-file-name)) | 1062 | (pcase (and buffer-file-name (file-name-extension buffer-file-name)) |
| 1051 | ("cc" (funcall search | 1063 | (`"cc" (funcall search |
| 1052 | "\\_<DEFUN\\(?:_DLD\\)?\\s-*(\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)" 1)) | 1064 | "\\_<DEFUN\\(?:_DLD\\)?\\s-*(\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)" 1)) |
| 1053 | (t (funcall search octave-function-header-regexp 3))))) | 1065 | (t (funcall search octave-function-header-regexp 3))))) |
| 1054 | 1066 | ||
| 1055 | (defun octave-function-file-p () | 1067 | (defun octave-function-file-p () |
| @@ -1118,19 +1130,19 @@ q: Don't fix\n" func file)) | |||
| 1118 | (read-char-choice | 1130 | (read-char-choice |
| 1119 | "Which name to use? (a/b/q) " '(?a ?b ?q)))))) | 1131 | "Which name to use? (a/b/q) " '(?a ?b ?q)))))) |
| 1120 | (pcase c | 1132 | (pcase c |
| 1121 | (?a (let ((newname (expand-file-name | 1133 | (`?a (let ((newname (expand-file-name |
| 1122 | (concat func (file-name-extension | 1134 | (concat func (file-name-extension |
| 1123 | buffer-file-name t))))) | 1135 | buffer-file-name t))))) |
| 1124 | (when (or (not (file-exists-p newname)) | 1136 | (when (or (not (file-exists-p newname)) |
| 1125 | (yes-or-no-p | 1137 | (yes-or-no-p |
| 1126 | (format "Target file %s exists; proceed? " newname))) | 1138 | (format "Target file %s exists; proceed? " newname))) |
| 1127 | (when (file-exists-p buffer-file-name) | 1139 | (when (file-exists-p buffer-file-name) |
| 1128 | (rename-file buffer-file-name newname t)) | 1140 | (rename-file buffer-file-name newname t)) |
| 1129 | (set-visited-file-name newname)))) | 1141 | (set-visited-file-name newname)))) |
| 1130 | (?b (save-excursion | 1142 | (`?b (save-excursion |
| 1131 | (goto-char name-start) | 1143 | (goto-char name-start) |
| 1132 | (delete-region name-start name-end) | 1144 | (delete-region name-start name-end) |
| 1133 | (insert file))))))))) | 1145 | (insert file))))))))) |
| 1134 | 1146 | ||
| 1135 | (defun octave-update-function-file-comment (beg end) | 1147 | (defun octave-update-function-file-comment (beg end) |
| 1136 | "Query replace function names in function file comment." | 1148 | "Query replace function names in function file comment." |
| @@ -1789,19 +1801,19 @@ If the environment variable OCTAVE_SRCDIR is set, it is searched first." | |||
| 1789 | (defun octave-find-definition-default-filename (name) | 1801 | (defun octave-find-definition-default-filename (name) |
| 1790 | "Default value for `octave-find-definition-filename-function'." | 1802 | "Default value for `octave-find-definition-filename-function'." |
| 1791 | (pcase (file-name-extension name) | 1803 | (pcase (file-name-extension name) |
| 1792 | ("oct" | 1804 | (`"oct" |
| 1793 | (octave-find-definition-default-filename | 1805 | (octave-find-definition-default-filename |
| 1794 | (concat "libinterp/dldfcn/" | 1806 | (concat "libinterp/dldfcn/" |
| 1795 | (file-name-sans-extension (file-name-nondirectory name)) | 1807 | (file-name-sans-extension (file-name-nondirectory name)) |
| 1796 | ".cc"))) | 1808 | ".cc"))) |
| 1797 | ("cc" | 1809 | (`"cc" |
| 1798 | (let ((file (or (locate-file name (octave-source-directories)) | 1810 | (let ((file (or (locate-file name (octave-source-directories)) |
| 1799 | (locate-file (file-name-nondirectory name) | 1811 | (locate-file (file-name-nondirectory name) |
| 1800 | (octave-source-directories))))) | 1812 | (octave-source-directories))))) |
| 1801 | (or (and file (file-exists-p file)) | 1813 | (or (and file (file-exists-p file)) |
| 1802 | (error "File `%s' not found" name)) | 1814 | (error "File `%s' not found" name)) |
| 1803 | file)) | 1815 | file)) |
| 1804 | ("mex" | 1816 | (`"mex" |
| 1805 | (if (yes-or-no-p (format "File `%s' may be binary; open? " | 1817 | (if (yes-or-no-p (format "File `%s' may be binary; open? " |
| 1806 | (file-name-nondirectory name))) | 1818 | (file-name-nondirectory name))) |
| 1807 | name | 1819 | name |