[slime-cvs] CVS slime/contrib
CVS User sboukarev
sboukarev at common-lisp.net
Sun Nov 22 13:03:12 UTC 2009
Update of /project/slime/cvsroot/slime/contrib
In directory cl-net:/tmp/cvs-serv31207/contrib
Modified Files:
ChangeLog slime-repl.el
Log Message:
contrib/slime-repl.el:
(slime-repl-history-remove-duplicates): New variable,
if set to T previous matching history entries are removed before
appending a new item. Default value is NIL.
(slime-repl-history-trim-whitespaces): New variable, when T remove
whitespaces at the beginning and end of a new history item.
Default value is NIL.
(slime-repl-add-to-input-history): Implement behaviour of the variables
above.
(slime-string-trim): New function, works like cl:string-trim.
--- /project/slime/cvsroot/slime/contrib/ChangeLog 2009/11/22 10:12:17 1.281
+++ /project/slime/cvsroot/slime/contrib/ChangeLog 2009/11/22 13:03:10 1.282
@@ -1,3 +1,15 @@
+2009-11-22 Stas Boukarev <stassats at gmail.com>
+
+ * slime-repl.el (slime-repl-history-remove-duplicates): New variable,
+ if set to T previous matching history entries are removed before
+ appending a new item. Default value is NIL.
+ (slime-repl-history-trim-whitespaces): New variable, when T remove
+ whitespaces at the beginning and end of a new history item.
+ Default value is NIL.
+ (slime-repl-add-to-input-history): Implement behaviour of the variables
+ above.
+ (slime-string-trim): New function, works like cl:string-trim.
+
2009-11-22 Tobias C. Rittweiler <tcr at freebits.de>
* slime-fontifying-fu.el (slime-compute-region-for-font-lock): Set
--- /project/slime/cvsroot/slime/contrib/slime-repl.el 2009/11/20 15:48:18 1.30
+++ /project/slime/cvsroot/slime/contrib/slime-repl.el 2009/11/22 13:03:11 1.31
@@ -690,7 +690,7 @@
(defun slime-repl-return (&optional end-of-input)
"Evaluate the current input string, or insert a newline.
-Send the current input ony if a whole expression has been entered,
+Send the current input only if a whole expression has been entered,
i.e. the parenthesis are matched.
With prefix argument send the input even if the parenthesis are not
@@ -865,16 +865,41 @@
:type 'boolean
:group 'slime-repl)
+(defcustom slime-repl-history-remove-duplicates nil
+ "*When T all duplicates are removed except the last one."
+ :type 'boolean
+ :group 'slime-repl)
+
+(defcustom slime-repl-history-trim-whitespaces nil
+ "*When T strip all whitespaces from the beginning and end."
+ :type 'boolean
+ :group 'slime-repl)
+
(make-variable-buffer-local
(defvar slime-repl-input-history '()
"History list of strings read from the REPL buffer."))
+(defun slime-string-trim (character-bag string)
+ (flet ((find-bound (&optional from-end)
+ (position-if-not (lambda (char) (memq char character-bag))
+ string :from-end from-end)))
+ (let ((start (find-bound))
+ (end (find-bound t)))
+ (if start
+ (subseq string start (1+ end))
+ ""))))
+
(defun slime-repl-add-to-input-history (string)
"Add STRING to the input history.
Empty strings and duplicates are ignored."
- (unless (or (equal string "")
- (equal string (car slime-repl-input-history)))
- (push string slime-repl-input-history)))
+ (when slime-repl-history-trim-whitespaces
+ (setq string (slime-string-trim '(?\n ?\ ?\t) string)))
+ (unless (equal string "")
+ (when slime-repl-history-remove-duplicates
+ (setq slime-repl-input-history
+ (remove string slime-repl-input-history)))
+ (unless (equal string (car slime-repl-input-history))
+ (push string slime-repl-input-history))))
;; These two vars contain the state of the last history search. We
;; only use them if `last-command' was 'slime-repl-history-replace,
More information about the slime-cvs
mailing list