diff options
author | Tom Willemsen | 2012-08-07 09:49:08 +0200 |
---|---|---|
committer | Tom Willemsen | 2012-08-07 09:49:08 +0200 |
commit | e96da80199dd9b38c513bf57bb43aebf8b34920a (patch) | |
tree | 05058c534b28eb7771238561fb1cb5bf8f6d4598 | |
parent | 2d676665475369c8d8971c5befef7b6fcdee9f91 (diff) | |
download | avandu-e96da80199dd9b38c513bf57bb43aebf8b34920a.tar.gz avandu-e96da80199dd9b38c513bf57bb43aebf8b34920a.zip |
Abstract the parsing and creation of single lines
Don't use `replace-regexp-in-string' in so many places, use
`avandu--oneline'.
-rw-r--r-- | avandu.el | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -259,8 +259,7 @@ with `auth-source-search' and then by asking the user." "Insert the excerpt of an article." (let ((start-pos (point)) end-pos - (text (replace-regexp-in-string - "[ \t\n]*$" "" (avandu--clean-text excerpt)))) + (text (avandu--oneline excerpt))) (unless (or (not text) (string= text "")) (insert (propertize @@ -274,7 +273,7 @@ with `auth-source-search' and then by asking the user." "Insert a button with the label TITLE and store ID and LINK in the article-id and link properties, respectively." (insert-button - (replace-regexp-in-string "^[ \n\t]*\\|[ \n\t]*$" "" title) + (avandu--oneline title) 'face 'avandu-overview-unread-article 'article-id id 'link link @@ -288,7 +287,7 @@ the article-id and link properties, respectively." feed-id property." (unless (eq (point) (point-min)) (insert-char ?\n 1)) (insert-button - (replace-regexp-in-string "^[ \n\t]*\\|[ \n\t]*$" "" title) + (avandu--oneline title) 'face 'avandu-overview-feed 'feed-id id 'keymap avandu-feed-button-map @@ -296,6 +295,10 @@ feed-id property." (message "%s" (button-label button)))) (insert-char ?\n 2)) +(defun avandu--oneline (text) + "Make a single line out of and clean up TEXT." + (replace-regexp-in-string "[ \n\t]*$" "" (avandu--clean-text text))) + (defun avandu--password () "Get the password. This means either return `avandu-password' as-is, or if it's a function return the result of that function." |