From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/55319 Path: main.gmane.org!not-for-mail From: sigurd@12move.de (Karl =?iso-8859-1?q?Pfl=E4sterer?=) Newsgroups: gmane.emacs.gnus.general Subject: A lot of questions concerning `gnus-score-edit-file-at-point' Date: Sun, 28 Dec 2003 18:45:31 +0100 Organization: Lemis World Sender: ding-owner@lists.math.uh.edu Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1072633804 24189 80.91.224.253 (28 Dec 2003 17:50:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 28 Dec 2003 17:50:04 +0000 (UTC) Original-X-From: ding-owner+M3859@lists.math.uh.edu Sun Dec 28 18:50:00 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Aaf3A-0004xo-00 for ; Sun, 28 Dec 2003 18:50:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1Aaf33-0006tB-00; Sun, 28 Dec 2003 11:49:53 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1Aaf2s-0006st-00 for ding@lists.math.uh.edu; Sun, 28 Dec 2003 11:49:42 -0600 Original-Received: from quimby.gnus.org (quimby.gnus.org [80.91.224.244]) by justine.libertine.org (Postfix) with ESMTP id CE5B03A009B for ; Sun, 28 Dec 2003 11:49:41 -0600 (CST) Original-Received: from news by quimby.gnus.org with local (Exim 3.35 #1 (Debian)) id 1Aaf2r-0002XX-00 for ; Sun, 28 Dec 2003 18:49:41 +0100 Original-To: ding@gnus.org Original-Path: wintendo.pflaesterer.de!not-for-mail Original-Newsgroups: gnus.ding Original-Lines: 124 Original-NNTP-Posting-Host: p62.246.44.85.tisdip.tiscali.de Original-X-Trace: quimby.gnus.org 1072633781 9764 62.246.44.85 (28 Dec 2003 17:49:41 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Sun, 28 Dec 2003 17:49:41 +0000 (UTC) X-Face: #iIcL\6>Qj/G*F@AL9T*v/R$j@7Q`6#FU&Flg6u6aVsLdWf(H$U5>:;&*>oy>jOIWgA%8w* A!V7X`\fEGoQ[@D'@i^*p3FCC6&Rg~JT/H_*MOX;"o~flADb8^ Mail-Copies-To: never User-Agent: Gnus/5.1003 (Gnus v5.10.3) Hamster/2.0.4.0 Cancel-Lock: sha1:8vzoPxI5uZCvVT3o5gqdbtY8H68= Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:55319 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:55319 Hi, Reiner Steib asked in the NG dcsg if someone liked to look for `gnus-score-edit-file-at-point' which has a big FIXME in the comment. So I tried my luck (thought it wouldn't be too hard) and found a working solution[a]. It's pretty near the original but I'm not really pleased with it; used in a *Score Trace* buffer it works but fails easily in another buffer. So I wrote solution[b]. It works in other buffers also but it's not the right thing yet IMO. I have sveral questions (a) Does anyone really use `gnus-score-edit-file-at-point' outside a *Score Trace* buffer? If not the function could be written simpler. (b) At the moment `ffap-string-at-point' gets used in that function. But that's the sole usage of that function in gnus-score.el (the sole usage in Gnus at all). If `gnus-score-edit-file-at-point' would only be used in *Score Trace* buffers a simple `buffer-substring' would give the same effect as `ffap-string-at-point'. (c) Furthermore there would no longer be a need to define it interactive. To bind it to a key the function could get called by a lambda form. That would help to clean the interactive namespace a bit (one function less :-) ). So that leads to[d]=20=20 So what do you say? KP _____ [a]=20 (defun gnus-score-edit-file-at-point () "Edit score file at point. Useful especially after `V t'." (interactive) (let ((rule (save-excursion (beginning-of-line) (read (current-buffer)))) (sep "[ \n\r\t]*") (file (save-excursion (end-of-line) (ffap-string-at-point)))) (if (string=3D "" file) (gnus-message 3 "Can't open no file") (gnus-score-edit-file file) (when (consp rule) ;; the rule exists (setq rule (mapconcat #'(lambda (obj) (regexp-quote (format "%S" obj))) rule sep)) (goto-char (point-min)) (re-search-forward rule nil t))))) [b]=20 (defun gnus-score-edit-file-at-point () "Edit score file at point. Useful especially after `V t'." (interactive) (let ((rule (save-excursion (beginning-of-line) (read (current-buffer)))) (sep "[ \n\r\t]*") (file (if (string=3D (buffer-name) "*Score Trace*")=20 ;; a Score Trace buffer (save-excursion (end-of-line) (ffap-string-at-point)) (ffap-string-at-point)))) (if (string=3D "" file) (gnus-message 3 "Can't open no file") (gnus-score-edit-file file) (when (consp rule) ;; the rule exists (setq rule (mapconcat #'(lambda (obj) (regexp-quote (format "%S" obj))) rule sep)) (goto-char (point-min)) (re-search-forward rule nil t))))) [d]=20 (defun gnus-score-edit-file-at-point () "Edit score file at point. Useful especially after `V t'." (let ((rule (save-excursion (beginning-of-line) (read (current-buffer)))) (sep "[ \n\r\t]*") (file (save-excursion ;; only works in a Score Trace buffer (beginning-of-line) (re-search-forward "-> +" nil t) (buffer-substring (point) (point-at-eol))))) (if (string=3D "" file) (gnus-message 3 "Can't open no file") (gnus-score-edit-file file) (when (consp rule) ;; the rule exists (setq rule (mapconcat #'(lambda (obj) (regexp-quote (format "%S" obj))) rule sep)) (goto-char (point-min)) (re-search-forward rule nil t))))) (defun gnus-score-find-trace () . . . (local-set-key "e" (lambda () "Runs `gnus-score-edit-file-at-point'." (interactive) (gnus-score-edit-file-at-point))) . .) --=20 Der wahre Weltuntergang ist die Vernichtung des Geistes, der andere h=E4ngt= von dem gleichgiltigen Versuch ab, ob nach der Vernichtung des Geistes noch eine Welt bestehen kann. Karl Kraus 'Untergang der Welt durch schwarze Magie'