Function: gnus-score-edit-file-at-point
gnus-score-edit-file-at-point is a byte-compiled function defined in
gnus-score.el.gz.
Signature
(gnus-score-edit-file-at-point &optional FORMAT)
Documentation
Edit score file at point in Score Trace buffers.
If FORMAT, also format the current score file.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-score.el.gz
(defun gnus-score-edit-file-at-point (&optional format)
"Edit score file at point in Score Trace buffers.
If FORMAT, also format the current score file."
(let* ((rule (save-excursion
(beginning-of-line)
(read (current-buffer))))
(sep "[ \n\r\t]*")
;; Must be synced with `gnus-score-find-trace':
(reg " -> +")
(file (save-excursion
(end-of-line)
(if (and (re-search-backward reg (line-beginning-position) t)
(re-search-forward reg (line-end-position) t))
(buffer-substring (point) (line-end-position))
nil))))
(if (or (not file)
(string-match "\\<\\(non-file rule\\|A file\\)\\>" file)
;; (see `gnus-score-find-trace' and `gnus-score-advanced')
(string= "" file))
(gnus-error 3 "Can't find a score file in current line.")
(gnus-score-edit-file file)
(when format
(gnus-score-pretty-print))
(when (consp rule) ;; the rule exists
(setq rule (if (symbolp (car rule))
(format "(%S)" (car rule))
(mapconcat (lambda (obj)
(regexp-quote (format "%S" obj)))
rule
sep)))
(goto-char (point-min))
(let ((move (if (string-match "(.*)" rule)
0
-1)))
(re-search-forward rule nil t)
;; make it easy to use `kill-sexp':
(goto-char (+ move (match-beginning 0))))))))