diff options
| author | Simon Marshall | 1995-03-24 09:01:09 +0000 |
|---|---|---|
| committer | Simon Marshall | 1995-03-24 09:01:09 +0000 |
| commit | cd323f896b28b06145b2e0ad9f74ba6b425ee369 (patch) | |
| tree | 1af10750166e0faaf2693f565ab83df91ac0d64e | |
| parent | 2a1c968a69f5fb56e3b52215cdfa5becdbb4dda4 (diff) | |
| download | emacs-cd323f896b28b06145b2e0ad9f74ba6b425ee369.tar.gz emacs-cd323f896b28b06145b2e0ad9f74ba6b425ee369.zip | |
Changed match-string to defun, but still return nil (no error) if no match.
| -rw-r--r-- | lisp/subr.el | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 79da03d5027..b30fc965edb 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; subr.el --- basic lisp subroutines for Emacs | 1 | ;;; subr.el --- basic lisp subroutines for Emacs |
| 2 | 2 | ||
| 3 | ;;; Copyright (C) 1985, 1986, 1992, 1994 Free Software Foundation, Inc. | 3 | ;;; Copyright (C) 1985, 1986, 1992, 1994, 1995 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; This file is part of GNU Emacs. | 5 | ;; This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -831,15 +831,16 @@ Wildcards and redirection are handled as usual in the shell." | |||
| 831 | (cons 'progn body) | 831 | (cons 'progn body) |
| 832 | (list 'store-match-data original))))) | 832 | (list 'store-match-data original))))) |
| 833 | 833 | ||
| 834 | (defmacro match-string (num &optional string) | 834 | (defun match-string (num &optional string) |
| 835 | "Return string of text matched by last search. | 835 | "Return string of text matched by last search. |
| 836 | NUM specifies which parenthesized expression in the last regexp. | 836 | NUM specifies which parenthesized expression in the last regexp. |
| 837 | Value is nil if NUMth pair didn't match, or there were less than NUM pairs. | 837 | Value is nil if NUMth pair didn't match, or there were less than NUM pairs. |
| 838 | Zero means the entire text matched by the whole regexp or whole string. | 838 | Zero means the entire text matched by the whole regexp or whole string. |
| 839 | STRING should be given if the last search was by `string-match' on STRING." | 839 | STRING should be given if the last search was by `string-match' on STRING." |
| 840 | (list 'and (list 'match-beginning num) | 840 | (if (match-beginning num) |
| 841 | (append (if string (list 'substring string) '(buffer-substring)) | 841 | (if string |
| 842 | (list (list 'match-beginning num) (list 'match-end num))))) | 842 | (substring string (match-beginning num) (match-end num)) |
| 843 | (buffer-substring (match-beginning num) (match-end num))))) | ||
| 843 | 844 | ||
| 844 | (defun shell-quote-argument (argument) | 845 | (defun shell-quote-argument (argument) |
| 845 | "Quote an argument for passing as argument to an inferior shell." | 846 | "Quote an argument for passing as argument to an inferior shell." |