From d9f504cf497a663da603a568ddd9f292dd0c488c Mon Sep 17 00:00:00 2001 From: deego Date: Fri, 2 Sep 2005 19:24:59 +0000 Subject: [PATCH] [minor security] romove all text properties for extra safety, esp. at source --- ChangeLog | 18 ++++++++- erball.el | 8 ++-- erbbdb.el | 4 +- erbc.el | 101 +++++++++++++++++++++++++--------------------- erbc2.el | 4 +- erbeng.el | 8 ++-- erblisp.el | 4 +- erblog.el | 4 +- erbmsg.el | 8 ++-- erbot.el | 24 ++++++----- erbtrain.el | 6 +-- erburl.el | 2 +- erbutils.el | 112 +++++++++++++++++++++++++++++++--------------------- erbwiki.el | 6 +-- 14 files changed, 182 insertions(+), 127 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5302352..3e97d8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,26 @@ +2005-09-02 D Goel + + * .*.el: Get rid of all string properties everywhere, especially + right at the source, for extra security. + + * erbc.el (fsi-read): minor: read-> read-from-string for more + safety + (erbn-read): new + (fsi-read-from-string): new + (fsi-describe-variable): use erbn-read for safety + (fsi-require): ditto + + * erbbdb.el (erbbdb-add): ditto + 2005-08-31 D Goel * erbot.el (erbot-nickserv-p): Add auto-identify code, also enable by default, see doc for erbot-nickserv-p for how to make changes to your bot's .emacs. This is now required by freenode for privmsgs to work. - + (erbot-nickserv-p): Unde default behavior change. The default + behavior of erbot remains as xbefore: to *not*idontify by + default. 2005-08-28 Michael Olson diff --git a/erball.el b/erball.el index e2abf28..3683b0d 100644 --- a/erball.el +++ b/erball.el @@ -1,5 +1,5 @@ ;;; erball.el --- Functions on all files. -;; Time-stamp: <2005-08-31 10:54:32 deego> +;; Time-stamp: <2005-08-31 17:25:50 deego> ;; Copyright (C) 2002 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erbc.el @@ -44,9 +44,9 @@ A trailing backslash is required.") (defvar erball-compiling-p (if (erball-assoc-string "--compile-erbot" command-line-args-left) (progn - (message (concat "\nCompiling source in " - (file-name-nondirectory (expand-file-name ".")) - " ...\n")) + (message "%s" (concat "\nCompiling source in " + (file-name-nondirectory (expand-file-name ".")) + " ...\n")) (setq command-line-args-left (delete "--compile-erbot" command-line-args-left)) t) diff --git a/erbbdb.el b/erbbdb.el index 8951ad4..2bd6bf0 100644 --- a/erbbdb.el +++ b/erbbdb.el @@ -1,5 +1,5 @@ ;;; erbbdb.el --- -;; Time-stamp: <2005-08-11 20:31:33 deego> +;; Time-stamp: <2005-09-02 14:47:53 deego> ;; Copyright (C) 2002 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erbbdb.el @@ -191,7 +191,7 @@ If no record exists, then a nil is returned. ;; should almost always be the case.. except when nil.. (if (stringp oldnotes) (setq oldnotes - (ignore-errors (read oldnotes)))) + (ignore-errors (erbn-read oldnotes)))) (setq newnotes (format "%S" (append oldnotes (list note)))) (erbbdb-remove-not-really name) (erbbdb-change name newnotes))) diff --git a/erbc.el b/erbc.el index c744f4d..8c0381e 100644 --- a/erbc.el +++ b/erbc.el @@ -1,5 +1,5 @@ ;;; erbc.el --- Erbot user-interface commands -- see also erbc5.el -;; Time-stamp: <2005-08-11 20:29:52 deego> +;; Time-stamp: <2005-09-02 14:48:11 deego> ;; Copyright (C) 2002 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erbc.el @@ -271,6 +271,7 @@ If no such function, return the symbol 'unbound. " (when (and (null key) (null args)) (setq key "")) (unless (stringp key) + ;; is this safe? what about properties? (setq key (read-kbd-macro (mapconcat '(lambda (arg) (format "%s" arg)) (cons key args) @@ -407,8 +408,8 @@ nolimitp has to be eq 'nolimit for the nolimit effect to take place.. (let* ((f function) g ) - (if (stringp f) - (setq f (read f))) + (when (stringp f) + (setq f (erbn-read f))) (cond ((symbolp f) (progn @@ -416,7 +417,7 @@ nolimitp has to be eq 'nolimit for the nolimit effect to take place.. g (cond ((fboundp f) f) - (t (read (concat "fs-" (format "%s" f)))))) + (t (erbn-read (concat "fs-" (format "%s" f)))))) (unless (fboundp g) (setq g f)) (let* ((def (symbol-function g))) @@ -431,8 +432,7 @@ nolimitp has to be eq 'nolimit for the nolimit effect to take place.. (describe-function g) (describe-function g)) - ))) - ;; if list, DO NOT wanna eval it--> + ))) ;; if list, DO NOT wanna eval it--> (t "NO function specified")))) @@ -448,7 +448,7 @@ nolimitp has to be eq 'nolimit for the nolimit effect to take place.. (str3 "") ) (cond - ((stringp function) (setq function (read function))) + ((stringp function) (setq function (erbn-read function))) (t nil)) (cond ((null function) (format "Sorry, %s is not a symbol" function)) @@ -457,7 +457,7 @@ nolimitp has to be eq 'nolimit for the nolimit effect to take place.. (setq str2 (with-temp-buffer (where-is function t) - (buffer-string))) + (erbutils-buffer-string))) (concat str0 str1 str2 str3)) (t (format "Looks like %s is not a symbol" function))))) @@ -476,7 +476,7 @@ Use with caution only in privmsgs please, for may produce long outputs. " (unless variable (error "Syntax: , dv 'variable")) (let* ((f variable)) (if (stringp f) - (setq f (read f))) + (setq f (erbn-read f))) (cond ((symbolp f) (erbutils-describe-variable f)) @@ -494,7 +494,7 @@ So that the command df or dv works fine..Actually, df knows how to load unloaded features automatically." (if (stringp feature) - (setq feature (read feature))) + (setq feature (fsi-read feature))) (when (or (string-match "/" (format "%s" feature)) (string-match "\\\\" (format "%s" feature))) (error "Your safety is VERY important to us, so we avoid loading features containing slashes.")) @@ -916,7 +916,7 @@ local, because the parent function calling this function should have (newmsglist nil) (msgstr (erbutils-stringify msg)) ;(newstrmsg nil) - (lispmsg (read msgstr) + (lispmsg (erbn-read msgstr) )) @@ -978,7 +978,7 @@ local, because the parent function calling this function should have ;;(mapcar 'intern (cdr msg)))) ;;(read (cons (intern (first msg)) ;; (read (list (erbutils-stringify (cdr msg)))))) - (read (concat "( "(erbutils-stringify msg) " )")))) + (fsi-read (concat "( "(erbutils-stringify msg) " )")))) ((equal 0 (string-match "\\(s\\|r\\)/" (first msg))) @@ -1159,7 +1159,7 @@ Else, of course, do the usual thing: viz. call describe... (progn (unless (stringp tmpv) (setq tmpv (format "%s" tmpv))) - (not (integerp (ignore-errors (read tmpv)))))))) + (not (integerp (ignore-errors (erbn-read tmpv)))))))) ;;(setq searchp t) (setq mainterm (concat mainterm ".*" tmpv)) @@ -1304,7 +1304,7 @@ anything useful. "))) (defun fsi-eval-or-say (str &optional fs-victim) (let ((aa (when (stringp str) - (ignore-errors (read str))))) + (ignore-errors (erbn-read str))))) (cond ((consp aa) (unless fs-victim (setq fs-victim fs-nick)) @@ -1471,7 +1471,7 @@ Optional argument ARGS ." (replace-string prefix "") (text-mode) (fill-paragraph 1) - (read (buffer-substring (point-min) (point-max)))))) + (erbn-read (buffer-substring (point-min) (point-max)))))) shortnames)) (defun fsi-commands (&optional regexp N M &rest foo) @@ -1959,11 +1959,11 @@ it was addressed at last. " ) (if (stringp N) - (setq N (read N))) + (setq N (erbn-read N))) (unless (integerp N) (setq N 0)) (if (stringp M) - (setq M (read M))) + (setq M (erbn-read M))) (if (and (integerp M) (= M N)) (setq M (+ N 1))) (setq records @@ -2075,11 +2075,11 @@ number N, and ending at M-1. The first record is numbered 0. ) (setq foo (fs-correct-entry foo)) (if (stringp N) - (setq N (read N))) + (setq N (erbn-read N))) (unless (integerp N) (setq N 0)) (if (stringp M) - (setq M (read M))) + (setq M (erbn-read M))) (if (and (integerp M) (= M N)) (setq M (+ N 1))) (unless (stringp foo) @@ -2089,7 +2089,7 @@ number N, and ending at M-1. The first record is numbered 0. foo )) (result1 (and (stringp result0) - (ignore-errors (read result0)))) + (ignore-errors (erbn-read result0)))) (len (length result1)) (newM (if (and (integerp M) (< M len)) @@ -2332,15 +2332,15 @@ Move the FROMth entry to the TOth position in the given TERM. Numbering of positions starts from 0. " (unless term (error "Syntax: , N->M in TERM (no term found)")) (when (stringp from) - (setq from (read from))) + (setq from (erbn-read from))) (when (stringp to) - (setq to (read to))) + (setq to (erbn-read to))) (unless (stringp term) (setq term (format "%s" term))) (let* ((exactnotes (erbbdb-get-exact-notes term)) (realterm (erbbdb-get-exact-name term)) - (notes (and (stringp exactnotes ) (read exactnotes))) + (notes (and (stringp exactnotes ) (erbn-read exactnotes))) (len (length notes)) (max (- len 1)) (newnotes notes) @@ -2400,7 +2400,7 @@ With NUMBER, forget only the NUMBERth entry of NAME. " (numstring (entries0 (erbbdb-get-exact-notes name)) (entries (and (stringp entries0 ) - (ignore-errors (read entries0)))) + (ignore-errors (erbn-read entries0)))) (len (length entries))) (unless entries @@ -2409,7 +2409,7 @@ With NUMBER, forget only the NUMBERth entry of NAME. " (setq number 0)) (setq numstring (downcase (format "%s" number))) (when (stringp number) - (setq number (read number))) + (setq number (erbn-read number))) (unless (integerp number) (setq number nil)) (unless (or number @@ -2588,7 +2588,7 @@ Syntax: , no foo is bar." (progn (let* ((fir (first args)) (aa (erbbdb-get-exact-notes fir)) - (notes (and (stringp aa) (read aa))) + (notes (and (stringp aa) (erbn-read aa))) (len (length notes))) (when (= len 0) (error "There's no such term %s. Use , %s is ..." fir fir)) @@ -2955,7 +2955,7 @@ Thus, keep it below, say 350." (goto-char (point-min)) (let ((fill-column fs-internal-fill-column)) (fill-paragraph nil)) - (buffer-string))) + (erbutils-buffer-string))) (t "\n"))) (defun fsi-dunnet-mode (&optional arg) @@ -3251,7 +3251,7 @@ here." "Show the apropos-matches of regexp starting at match number N" (unless regexp (error "Syntax: , apropos REGEXP &optional N M")) - (if (stringp N) (setq N (read N))) + (if (stringp N) (setq N (erbn-read N))) (unless (integerp N) (setq N 0)) (unless (stringp regexp) (setq regexp (format "%s" regexp))) @@ -3282,7 +3282,7 @@ here." (defun fsi-find-variable-internal (function &optional nolimitp &rest ignore) "Finds the variable named FUNCTION." - (if (stringp function) (setq function (read function))) + (if (stringp function) (setq function (erbn-read function))) (cond ((symbolp function) (unless (boundp function) @@ -3330,7 +3330,7 @@ here." (unless function (error "Syntax: (ff 'fucntion)")) - (if (stringp function) (setq function (read function))) + (if (stringp function) (setq function (erbn-read function))) (cond ((symbolp function) (unless (fboundp function) @@ -3435,7 +3435,7 @@ number N, and ending at M-1. The first record is numbered 0. mainterm )) (result1 (and (stringp result0) - (ignore-errors (read result0)))) + (ignore-errors (erbn-read result0)))) (len (length result1))) (cond ;; in cond0 @@ -3556,7 +3556,7 @@ number N, and ending at M-1. The first record is numbered 0. (setq num (if (numberp fir) fir - (ignore-errors (read fir))))) + (ignore-errors (erbn-read fir))))) (if (numberp num) (setq args (cdr args)) (setq num 1)) @@ -3646,7 +3646,7 @@ author know.." (defun fsi-cp (name dest) (let* ((exn (erbbdb-get-exact-notes name)) - (notes (and (stringp exn) (read exn)))) + (notes (and (stringp exn) (erbn-read exn)))) (unless notes (error "No such term %s" name)) (when (erbbdb-get-exact-notes dest) @@ -3658,7 +3658,7 @@ author know.." (defun fsi-notes (name) "Internal. Return the notes as a list. " (let ((exnotes (erbbdb-get-exact-notes name))) - (and (stringp exnotes) (read exnotes)))) + (and (stringp exnotes) (erbn-read exnotes)))) @@ -3826,7 +3826,7 @@ MSG here is a list which needs to be combined. " (setq sr (if (equal 0 (string-match "s" (first remmsg))) "s" "r")) (setq las (first (last remmsg))) - (setq number (and (stringp las) (read las))) + (setq number (and (stringp las) (erbn-read las))) (if (or (numberp number) (equal 0 (string-match "all" @@ -3842,7 +3842,7 @@ MSG here is a list which needs to be combined. " (when termcheckp (let* ((exn (erbbdb-get-exact-notes term)) - (notes (and (stringp exn) (read exn))) + (notes (and (stringp exn) (erbn-read exn))) (len (length notes))) (if (> len 1) (throw 'erbnocmd-repl-error @@ -3955,14 +3955,14 @@ initargs. Then the function is applied as (function @initargs string (setq number (format "%s" number)) (let* ((exactnotes (erbbdb-get-exact-notes term)) - (notes (and (stringp exactnotes) (read exactnotes))) + (notes (and (stringp exactnotes) (erbn-read exactnotes))) (len (length notes)) newnotes newnote (lenargs (length arglist)) (initargs (subseq arglist 0 (- lenargs 1))) (finargs (first (last arglist))) - (numnum (read number)) + (numnum (erbn-read number)) ) (when (and (null number) (= len 1)) (setq number 0)) (unless exactnotes (error "No such term: %S" term)) @@ -4106,9 +4106,9 @@ last time i checked , equalp seemed to work as well.. " (defun fsi-channel-members (&optional n m &rest args) (when (stringp n) - (setq n (ignore-errors (read n)))) + (setq n (ignore-errors (erbn-read n)))) (when (stringp m) - (setq m (ignore-errors (read m)))) + (setq m (ignore-errors (erbn-read m)))) (unless (integerp n) (setq n 0)) (unless (integerp m) (setq m nil)) (subseq (fs-channel-members-all) n m)) @@ -4830,7 +4830,7 @@ See: http://www.w3.org/Security/faq/wwwsf4.html#CGI-Q7 ;; (buffer-string)).. and cause a huge uservariables file.. (defun fsi-buffer-string (&rest args) - (buffer-string-no-properties (point-min) (point-max))) + (buffer-substring-no-properties (point-min) (point-max))) (defalias 'fsi-buffer-substring 'buffer-substring-no-properties) @@ -5039,18 +5039,29 @@ query to another user. " Note: Used by fs-describe" (cond ((stringp arg) - (condition-case fs-tmp (read arg) + (condition-case fs-tmp (erbn-read arg) (error arg))) (t arg))) -(defun fsi-read (str) +(defun erbn-read-from-string (str) + (let (str2) (cond ((stringp str) - (read str)) - (t (error "The bot will only read from strings. ")))) + (setq str2 (copy-sequence str)) + (set-text-properties 0 (length str2) nil str2) + (read-from-string str)) + (t (error "The bot will only read from strings. "))))) + + + +(defun erbn-read (str) + "Like read, but only from strings" + (car (erbn-read-from-string str))) +(defalias 'fsi-read 'erbn-read) +(defalias 'fsi-read-from-string 'erbn-read-from-string) (erbutils-defalias-i diff --git a/erbc2.el b/erbc2.el index 80c9fc0..8ca0488 100644 --- a/erbc2.el +++ b/erbc2.el @@ -1,5 +1,5 @@ ;;; erbc2.el --- mostly: special functions for erbc.el -;; Time-stamp: <2005-08-11 20:30:03 deego> +;; Time-stamp: <2005-09-02 14:34:33 deego> ;; Copyright (C) 2003 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erbc2.el @@ -308,7 +308,7 @@ bash-specific-quotes, like random, should work." ;; (when (and aa bb) ;; (buffer-substring-no-properties aa bb))) (set-buffer "*bash*") - (setq bashstr (buffer-string)) + (setq bashstr (erbutils-buffer-string)) (with-temp-buffer (insert bashstr) (goto-char (point-min)) diff --git a/erbeng.el b/erbeng.el index 3e0a728..6366f6a 100644 --- a/erbeng.el +++ b/erbeng.el @@ -1,5 +1,5 @@ ;;; erbeng.el --- -;; Time-stamp: <2005-08-11 20:32:33 deego> +;; Time-stamp: <2005-09-02 14:18:08 deego> ;; Copyright (C) 2002 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erbeng.el @@ -177,7 +177,7 @@ nil nil\ nil nil nil nil nil nil nil nil] (defun erbeng-lisp-object-p (msg) - (setq msg (ignore-errors (read msg))) + (setq msg (ignore-errors (erbn-read msg))) (and (listp msg) (let ((fir (format "%s" (first msg)))) (or @@ -247,7 +247,7 @@ nil nil\ nil nil nil nil nil nil nil nil] (defun erbeng-get-reply (msg &optional proc nick tgt &rest foo) " ;; now assumes that the msg is (a string) in lisp format... and this just ;; evals it.." - (eval (read msg))) + (eval (erbn-read msg))) ; (let* ( ; (lispmsg ; (erbeng-read (erbutils-stringify msg)))) @@ -260,7 +260,7 @@ nil nil\ nil nil nil nil nil nil nil nil] (defun erbeng-read (msg) - (ignore-errors (read msg))) + (ignore-errors (erbn-read msg))) diff --git a/erblisp.el b/erblisp.el index 8e623db..c500c69 100644 --- a/erblisp.el +++ b/erblisp.el @@ -1,5 +1,5 @@ ;;; erblisp.el --- -;; Time-stamp: <2005-08-11 20:33:12 deego> +;; Time-stamp: <2005-09-02 14:18:07 deego> ;; Copyright (C) 2002 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erblisp.el @@ -52,7 +52,7 @@ something like This command sandboxes the message and then processes it.." (if (stringp msg) - (setq msg (read msg))) + (setq msg (erbn-read msg))) (format "%s" (eval (erblisp-sandbox-fuzzy msg)))) (defun erblisp-sandbox-quoted-maybe (expr) diff --git a/erblog.el b/erblog.el index 53ad918..087e9a2 100644 --- a/erblog.el +++ b/erblog.el @@ -1,5 +1,5 @@ ;;; erblog.el --- -;; Time-stamp: <2005-08-11 20:33:23 deego> +;; Time-stamp: <2005-08-31 17:14:50 deego> ;; Copyright (C) 2002 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erblog.el @@ -62,7 +62,7 @@ out which channels have had activity... ;; operator bind to C-c s (defun erblog-show-targets () (interactive) - (message (format "%s" erblog-active-targets))) + (message "%s" erblog-active-targets)) ;; bind to C-c r (defun erblog-reset-targets () diff --git a/erbmsg.el b/erbmsg.el index d8fe998..059cfc2 100644 --- a/erbmsg.el +++ b/erbmsg.el @@ -1,5 +1,5 @@ ;;; erbmsg.el --- memoserv-esque functions for Erbot -;; $Id: erbmsg.el,v 1.23 2005/03/29 20:06:51 hroptatyr Exp $ +;; $Id: erbmsg.el,v 1.24 2005/09/02 19:24:59 deego Exp $ ;; Copyright (C) 2004 Sebastian Freundt ;; Emacs Lisp Archive entry ;; Filename: erbmsg.el @@ -14,7 +14,7 @@ (defconst erbot-home-page "http://savannah.nongnu.org/projects/erbot") (defconst erbmsg-version - "Version 0.2 $Revision: 1.23 $") + "Version 0.2 $Revision: 1.24 $") ;; This file is NOT (yet) part of GNU Emacs. @@ -542,8 +542,8 @@ if so return 'noreply, if not return an according answer." (and (file-readable-p file) (with-temp-buffer (insert-file-contents file) - (eval (read (format "(setq file-vector '(%s))" - (buffer-string)))))))) + (eval (erbn-read (format "(setq file-vector '(%s))" + (erbutils-buffer-string)))))))) (mapvector (lambda (tablevector) (let ((table (aref tablevector 0)) diff --git a/erbot.el b/erbot.el index c37e89c..f7f1e50 100644 --- a/erbot.el +++ b/erbot.el @@ -1,5 +1,5 @@ ;;; erbot.el --- Another robot for ERC. -;; Time-stamp: <2005-08-31 11:35:11 deego> +;; Time-stamp: <2005-09-02 15:08:03 deego> ;; Emacs Lisp Archive entry ;; Filename: erbot.el ;; Package: erbot @@ -455,25 +455,29 @@ the new erc-backend functions." (erc-response.sender parsed)) (t (aref parsed 1)))) (userinfo (erc-parse-user sspec)) - (nick (nth 0 userinfo)) + (nick (erbutils-remove-text-properties-maybe (nth 0 userinfo))) ;; bind fs-nick in a let.. so that changes to fs-nick are ;; independent and do not affect each other.. when it is ;; parsing too many messages once.. (fs-nick nick) - (erbn-nick nick) + (erbn-nick fs-nick) (cmdargs (and erbot-on-new-erc-p (erc-response.command-args parsed))) - (tgta (cond (cmdargs - (nth 0 cmdargs)) - (t (aref parsed 2)))) + (tgta + (erbutils-remove-text-properties-maybe + (cond (cmdargs + (nth 0 cmdargs)) + (t (aref parsed 2))))) (tgt (if (equalp tgta (or (erc-current-nick) erbot-nick)) nick tgta)) (erbn-tgt tgt) (fs-tgt tgt) - (msg (cond (cmdargs - (nth 1 cmdargs)) - (t (aref parsed 3)))) + (msg + (erbutils-remove-text-properties-maybe + (cond (cmdargs + (nth 1 cmdargs)) + (t (aref parsed 3))))) (erbot-end-user-nick nick) ) ;; changing the structure here.. @@ -519,7 +523,7 @@ the new erc-backend functions." (while (re-search-forward "\n" nil t) (replace-match (concat "\n" erbot-init-string) nil t)) - (concat erbot-init-string (buffer-string)))))) + (concat erbot-init-string (erbutils-buffer-string)))))) (defvar erbot-init-string "" "The basic init string.. should be concated to ALL lines of diff --git a/erbtrain.el b/erbtrain.el index 31495f6..c37d837 100644 --- a/erbtrain.el +++ b/erbtrain.el @@ -1,5 +1,5 @@ ;;; erbtrain.el --- Train erbot (erbot).. -;; Time-stamp: <2005-08-11 20:35:09 deego> +;; Time-stamp: <2005-09-02 14:18:06 deego> ;; Copyright (C) 2002 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erbtrain.el @@ -133,7 +133,7 @@ advantage of being much faster. " (let* ((strlisp1 (ignore-errors (fs-parse str))) (strlisp (ignore-errors (if (stringp strlisp1) - (read strlisp1) nil))) + (erbn-read strlisp1) nil))) (result (ignore-errors (fs-eval strlisp)))) (erbtrain-local-log str strlisp result))) @@ -144,7 +144,7 @@ advantage of being much faster. " (insert "\n") (let ((msg (concat str "\n" "=> " (format "%S" expr) "\n" "==> " (format "%S" result) "\n\n"))) - (message (format "%s" msg)) + (message "%s" msg) (insert msg)))) diff --git a/erburl.el b/erburl.el index cc5238b..838e696 100644 --- a/erburl.el +++ b/erburl.el @@ -158,7 +158,7 @@ wish elisp supported lexical closures!)" cbargs)) (erbot-working (dolist (entry entries) - (message (format "Adding entry for %s" (first entry))) + (message "Adding entry for %s" (first entry)) (sleep-for 0.1) ;; I need to find a way to speed this up. As the bbdb gets ;; larger things really start to slow down significantly. diff --git a/erbutils.el b/erbutils.el index 3d642a0..77ce58b 100644 --- a/erbutils.el +++ b/erbutils.el @@ -1,5 +1,5 @@ ;;; erbutils.el --- -;; Time-stamp: <2005-08-11 20:27:57 deego> +;; Time-stamp: <2005-09-02 14:52:55 deego> ;; Copyright (C) 2002,2003,2004,2005 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erbutils.el @@ -236,27 +236,27 @@ as many times as it returns a... (terpri) (if (erbcompat-local-variable-p variable) (progn - (princ (format "Local in buffer %s; " (buffer-name))) - ;; (if (not (default-boundp variable)) - ;; (princ "globally void") - ;; (let ((val (default-value variable))) - ;; (with-current-buffer standard-output - ;; (princ "global value is ") - ;; (terpri) Fixme: pp can take an age if you happen - ;; ;; to ask for a very large - ;; ;; expression. We should - ;; ;; probably print it raw once - ;; ;; and check it's a sensible - ;; ;; size before prettyprinting. - ;; ;; -- fx - ;; (let ((from (point))) - ;; (pp val) - ;; (help-xref-on-pp from (point)) - ;; (if (< (point) (+ from 20)) - ;; (save-excursion - ;; (goto-char from) - ;; (delete-char -1))))))) - (terpri))) + (princ (format "Local in buffer %s; " (buffer-name))) + ;; (if (not (default-boundp variable)) + ;; (princ "globally void") + ;; (let ((val (default-value variable))) + ;; (with-current-buffer standard-output + ;; (princ "global value is ") + ;; (terpri) Fixme: pp can take an age if you happen + ;; ;; to ask for a very large + ;; ;; expression. We should + ;; ;; probably print it raw once + ;; ;; and check it's a sensible + ;; ;; size before prettyprinting. + ;; ;; -- fx + ;; (let ((from (point))) + ;; (pp val) + ;; (help-xref-on-pp from (point)) + ;; (if (< (point) (+ from 20)) + ;; (save-excursion + ;; (goto-char from) + ;; (delete-char -1))))))) + (terpri))) (terpri) ;; (with-current-buffer standard-output ;; (if (> (count-lines (point-min) (point-max)) 10) @@ -277,32 +277,32 @@ as many times as it returns a... ;; (princ "Documentation:") (terpri) (let ((doc - (documentation-property variable 'variable-documentation))) + (documentation-property variable 'variable-documentation))) (princ (or doc "not documented as a variable."))) - (help-setup-xref (list #'describe-variable variable (current-buffer)) - (interactive-p)) + (help-setup-xref (list #'describe-variable variable (current-buffer)) + (interactive-p)) ;; Make a link to customize if this variable can be customized. ;; Note, it is not reliable to test only for a custom-type property ;; because those are only present after the var's definition ;; has been loaded. (if (or (get variable 'custom-type) ; after defcustom - (get variable 'custom-loads) ; from loaddefs.el - (get variable 'standard-value)) ; from cus-start.el + (get variable 'custom-loads) ; from loaddefs.el + (get variable 'standard-value)) ; from cus-start.el (let ((customize-label "customize")) - (terpri) - (terpri) - (princ (concat "You can " customize-label " this variable.")) - (with-current-buffer "*Help*" - (save-excursion - (re-search-backward - (concat "\\(" customize-label "\\)") nil t) - (help-xref-button 1 (lambda (v) - (if help-xref-stack - (pop help-xref-stack)) - (customize-variable v)) - variable - "mouse-2, RET: customize variable"))))) + (terpri) + (terpri) + (princ (concat "You can " customize-label " this variable.")) + (with-current-buffer "*Help*" + (save-excursion + (re-search-backward + (concat "\\(" customize-label "\\)") nil t) + (help-xref-button 1 (lambda (v) + (if help-xref-stack + (pop help-xref-stack)) + (customize-variable v)) + variable + "mouse-2, RET: customize variable"))))) ;; Make a hyperlink to the library if appropriate. (Don't ;; change the format of the buffer's initial line in case ;; anything expects the current format.) @@ -326,7 +326,9 @@ as many times as it returns a... (save-excursion (set-buffer standard-output) ;; Return the text we displayed. - (buffer-string))))))) + (buffer-substring-no-properties (point-min) (point-max)))))))) + + (defvar erbutils-itemize-style @@ -382,7 +384,7 @@ as many times as it returns a... (if (stringp (sexp-at-point)) ;; this sets mark.. bad programming, i know.. (backward-kill-sexp 1)) - (buffer-string))) + (erbutils-buffer-string))) (erbutils-single-lines newdoc))) (defun erbutils-single-lines (str) @@ -633,7 +635,7 @@ might prefer calling erbutils-defalias-i instead. (and (stringp str) (not (string= str "")) - (setq expr (read (concat " ( " str " )")))))) + (setq expr (erbn-read (concat " ( " str " )")))))) (defun erbutils-functions-in-file (file) @@ -644,7 +646,7 @@ lisp file, else error. " (and (stringp str) (not (string= str "")) - (setq expr (read (concat " ( " str " )"))) + (setq expr (erbn-read (concat " ( " str " )"))) (ignore-errors (mapcar 'second expr))))) @@ -688,4 +690,26 @@ Thanks to edrx on #emacs for suggesting 'symbol-name.." + +(defun erbutils-remove-text--properties (str) + (let (str2) + (cond + ((stringp str) + (setq str2 (copy-sequence str)) + (set-text-properties 0 (length str2) nil str2) + str2) + (t (error "Not a string."))))) + + + + +(defun erbutils-remove-text-properties-maybe (str) + (if (stringp str) + (erbutils-remove-text-properties str) + str)) + + +(defun erbutils-buffer-string () + (buffer-substring-no-properties (point-min) (point-max))) + ;;; erbutils.el ends here diff --git a/erbwiki.el b/erbwiki.el index 81672d7..2f4ce48 100644 --- a/erbwiki.el +++ b/erbwiki.el @@ -1,5 +1,5 @@ ;;; erbwiki.el --- SECURITY RISK, READ BELOW. -;; Time-stamp: <2005-08-11 20:29:00 deego> +;; Time-stamp: <2005-09-02 14:18:11 deego> ;; Copyright (C) 2002, 2003 D. Goel ;; Emacs Lisp Archive entry ;; Filename: erbwiki.el @@ -483,11 +483,11 @@ connected." (ignore-errors (find-file lastfile) (goto-char (point-min)) - (setq oldfields (ignore-errors (read (get-file-buffer lastfile))))) + (setq oldfields (ignore-errors (erbn-read (get-file-buffer lastfile))))) (find-file newfile) (goto-char (point-min)) (setq currentfields (ignore-errors - (read (get-file-buffer newfile)))) + (erbn-read (get-file-buffer newfile)))) (setq newfields (set-difference currentfields oldfields :test 'equal