[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5dd3035 19/28: Refactor trim functions.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 5dd3035 19/28: Refactor trim functions. |
Date: |
Tue, 05 May 2015 11:10:23 +0000 |
branch: master
commit 5dd3035f60d39daf33dd1ff262881911676c659e
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Refactor trim functions.
---
context-coloring.el | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 010e0af..06c22e9 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -68,16 +68,22 @@
"Join a list of STRINGS with the string DELIMITER."
(mapconcat 'identity strings delimiter))
-(defun context-coloring-trim (string)
- "Remove leading and trailing whitespace from STRING."
- ;; Trim right.
- (when (string-match "[ \t\n\r]+\\'" string)
- (setq string (replace-match "" t t string)))
- ;; Trim left.
+(defsubst context-coloring-trim-right (string)
+ "Remove leading whitespace from STRING."
+ (if (string-match "[ \t\n\r]+\\'" string)
+ (replace-match "" t t string)
+ string))
+
+(defsubst context-coloring-trim-left (string)
+ "Remove trailing whitespace from STRING."
(if (string-match "\\`[ \t\n\r]+" string)
(replace-match "" t t string)
string))
+(defsubst context-coloring-trim (string)
+ "Remove leading and trailing whitespace from STRING."
+ (context-coloring-trim-left (context-coloring-trim-right string)))
+
;;; Faces
- [elpa] master 0888e06 01/28: Use Cask and Coveralls., (continued)
- [elpa] master 0888e06 01/28: Use Cask and Coveralls., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 202ca74 15/28: Drop `subr-x' dependency., Jackson Ray Hamilton, 2015/05/05
- [elpa] master dd3fe3c 06/28: Fix badges., Jackson Ray Hamilton, 2015/05/05
- [elpa] master fb53884 17/28: Update README., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 52da59c 18/28: Bust cache., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 3f63fab 11/28: Add local coverage configuration., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 158fd83 16/28: Test the trimming function., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 0c20edf 14/28: Add coverage for missing lines., Jackson Ray Hamilton, 2015/05/05
- [elpa] master d116055 12/28: Fix original-maximum-face restoration bug., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 1b6f6fb 21/28: Cleanup README., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 5dd3035 19/28: Refactor trim functions.,
Jackson Ray Hamilton <=
- [elpa] master f8cfd37 22/28: Double-space., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 64852e7 24/28: Update library headers., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 55ca15a 23/28: Guard against excessively lenghty nodes., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 8f1af4a 20/28: Update library header., Jackson Ray Hamilton, 2015/05/05
- [elpa] master dbddc45 26/28: Reimplement coverage reporter in elisp., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 6ee3f82 25/28: Refactor coverage., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 283a006 27/28: Version 6.2.1., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 8a083d5 28/28: Merge commit '283a006be8e96c7e011dedddb460b289d335a9fb' from context-coloring, Jackson Ray Hamilton, 2015/05/05