summaryrefslogtreecommitdiffhomepage
path: root/lib/net/randomsig.el
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net/randomsig.el')
-rw-r--r--lib/net/randomsig.el82
1 files changed, 36 insertions, 46 deletions
diff --git a/lib/net/randomsig.el b/lib/net/randomsig.el
index 9029f13..e3c735b 100644
--- a/lib/net/randomsig.el
+++ b/lib/net/randomsig.el
@@ -308,7 +308,7 @@ You probably want to have a newline at the end of it."
;; get a list with file names of signature files
(let ((sigfiles (randomsig-files-to-list files)))
;; Insert all files into the newly created buffer
- (mapcar
+ (mapc
(lambda (fname)
(let ((pos (point-max)))
@@ -348,10 +348,10 @@ You probably want to have a newline at the end of it."
(defun randomsig-goto-signature ()
-;; This function is stolen fom message-goto signature.
-;; Go to beginnig of the signature, and return t.
-;; If there is no signature in current buffer, go to end of buffer,
-;; and return nil.
+ ;; This function is stolen fom message-goto signature.
+ ;; Go to beginnig of the signature, and return t.
+ ;; If there is no signature in current buffer, go to end of buffer,
+ ;; and return nil.
(goto-char (point-min))
(if (re-search-forward "^-- $" nil t)
(progn
@@ -383,30 +383,25 @@ Else a signature out of `randomsig-files' will be choosen."
(randomsig-read-signatures-to-buffer randomsig-buffer-name files)
(goto-char (point-min))
- (let '(count 0) 'selected
-
- ;; Count number of signatures
- (while (search-forward-regexp randomsig-delimiter-pattern nil t)
- (setq count (1+ count)))
-
- ;; Select random signature out out these
- (setq selected (1+ (random count)))
- (goto-char (point-min))
- (if (search-forward-regexp randomsig-delimiter-pattern nil t selected)
- (forward-char))
-
- ;; Cut signature and return it
- (let '(here (point)) 'signature-string
-
- (if (not (search-forward-regexp randomsig-delimiter-pattern
- nil t))
- (goto-char (point-max))
- (beginning-of-line))
- (setq signature-string
- (concat randomsig-static-string
- (buffer-substring here (point))))
- (kill-buffer randomsig-buffer-name)
- signature-string))))
+ (let ((count 0) (selected nil))
+ ;; Count number of signatures
+ (while (search-forward-regexp randomsig-delimiter-pattern nil t)
+ (setq count (1+ count)))
+ ;; Select random signature out out these
+ (setq selected (1+ (random count)))
+ (goto-char (point-min))
+ (if (search-forward-regexp randomsig-delimiter-pattern nil t selected)
+ (forward-char))
+ ;; Cut signature and return it
+ (let ((here (point))
+ (signature-string nil))
+ (if (not (search-forward-regexp randomsig-delimiter-pattern nil t))
+ (goto-char (point-max))
+ (beginning-of-line))
+ (setq signature-string
+ (concat randomsig-static-string (buffer-substring here (point))))
+ (kill-buffer randomsig-buffer-name)
+ signature-string))))
(defun randomsig-replace-sig (arg)
@@ -415,34 +410,31 @@ When called with prefix, read the filename of the signature-file
that should be used"
(interactive "P")
(save-excursion
-
(randomsig-replace-signature
(randomsig-signature
(if arg
(randomsig-prompt "read from signature-lib: ")
randomsig-files)))))
-
-
(defun randomsig-message-read-sig (arg)
"Get the signature of current message and copy it to a file.
If mark is active, get the marked region instead.
When called with prefix, let the user edit the signature before saving"
(interactive "P")
(save-excursion
- (let '(signature-string
+ (let ((signature-string
(if (randomsig-mark-active-p)
(buffer-substring (point) (mark))
(progn
(if (randomsig-goto-signature)
- (let `(here (point))
+ (let ((here (point)))
(goto-char (point-max))
(while (char-equal (char-before) 10)
(backward-char))
(buffer-substring here (point)))
- nil))))
+ nil)))))
(when signature-string
(if arg
(progn
@@ -451,7 +443,6 @@ When called with prefix, let the user edit the signature before saving"
(randomsig-edit signature-string))
(randomsig-write-signature signature-string))))))
-
(defun randomsig-write-signature (signature-string)
(set-buffer (find-file-noselect
(expand-file-name
@@ -465,14 +456,13 @@ When called with prefix, let the user edit the signature before saving"
(save-buffer))
-(defun gnus/randomsig-summary-read-sig (arg)
- "Get the signature of current message and copy it to a file"
- (interactive "P")
- (progn ;save-excursion
- ;; FIXME: Doesn't return to summary buffer (save-excursion should do this)
- (gnus-summary-select-article-buffer)
- (randomsig-message-read-sig arg)))
-
+;; (defun gnus/randomsig-summary-read-sig (arg)
+;; "Get the signature of current message and copy it to a file"
+;; (interactive "P")
+;; (progn ;save-excursion
+;; ;; FIXME: Doesn't return to summary buffer (save-excursion should do this)
+;; (gnus-summary-select-article-buffer)
+;; (randomsig-message-read-sig arg)))
(defun randomsig-search-sigfiles (&optional file)
"Scan `randomsig-dir' and its subdirectories for regular files.
@@ -489,7 +479,7 @@ If FILE is given, only FILE and its subdirectory will be searched."
;; unwanted...
nil
- (let '(path (expand-file-name file randomsig-dir))
+ (let ((path (expand-file-name file randomsig-dir)))
(if (file-directory-p path)
(mapcan (lambda (f)
(randomsig-search-sigfiles (if (string= file "")
@@ -571,7 +561,7 @@ You most likely do not want to call `randomsig-edit-mode' directly.
\\{randomsig-edit-mode-map}"
(define-key randomsig-edit-mode-map
- (kbd "C-c C-c") 'randomsig-edit-done))
+ (kbd "C-c C-c") 'randomsig-edit-done))
;;; Commands for randomsig-select-mode