Mercurial > emacs
comparison lisp/subr.el @ 112425:9f7614f1a892
Merge from emacs-23
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 22 Jan 2011 11:36:45 -0800 |
parents | aa1e27e3a554 106bf56d370e |
children |
comparison
equal
deleted
inserted
replaced
112416:f792eb37d0ca | 112425:9f7614f1a892 |
---|---|
2459 (concat "\"" result (substring argument start) "\"")) | 2459 (concat "\"" result (substring argument start) "\"")) |
2460 (if (equal argument "") | 2460 (if (equal argument "") |
2461 "''" | 2461 "''" |
2462 ;; Quote everything except POSIX filename characters. | 2462 ;; Quote everything except POSIX filename characters. |
2463 ;; This should be safe enough even for really weird shells. | 2463 ;; This should be safe enough even for really weird shells. |
2464 (let ((result "") (start 0) end) | 2464 (replace-regexp-in-string "\n" "'\n'" |
2465 (while (string-match "[^-0-9a-zA-Z_./]" argument start) | 2465 (replace-regexp-in-string "[^-0-9a-zA-Z_./\n]" "\\\\\\&" argument))))) |
2466 (setq end (match-beginning 0) | |
2467 result (concat result (substring argument start end) | |
2468 "\\" (substring argument end (1+ end))) | |
2469 start (1+ end))) | |
2470 (concat result (substring argument start)))))) | |
2471 | 2466 |
2472 (defun string-or-null-p (object) | 2467 (defun string-or-null-p (object) |
2473 "Return t if OBJECT is a string or nil. | 2468 "Return t if OBJECT is a string or nil. |
2474 Otherwise, return nil." | 2469 Otherwise, return nil." |
2475 (or (stringp object) (null object))) | 2470 (or (stringp object) (null object))) |