From: Victor Orlikowski <vjo@duke.edu>
To: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: [PATCH] v2: Fixes to allow erc-dcc-get-filter to work properly
Date: Sun, 10 Feb 2019 19:14:26 +0000 [thread overview]
Message-ID: <3FCFBDED-9040-41B1-9686-30773CA6EC08.notmuch@neverland> (raw)
In-Reply-To: CD36F2CB-49E3-4441-AEAF-DD6B62B1CF13.notmuch@neverland
When using erc-dcc-get-filter with erc-dcc-verbose set to t, message
errors prevent the DCC get from completing correctly.
The attached patch adds some additional error checking to
erc-dcc-get-filter, and uses ethe function buffer-name in place of
the variable buffer-file-name (which appears to be nil in this
context, which thereby causes the message errors).
From cd390337b8e819248568b900e6115dde8a19fde9 Mon Sep 17 00:00:00 2001
From: "Victor J. Orlikowski" <vjo@duke.edu>
Date: Sun, 10 Feb 2019 11:13:57 -0500
Subject: [PATCH] Perform additional validation in erc-dcc-get-filter, and use
the function buffer-name rather than buffer-file-name (which is actually nil
in this context).
---
lisp/erc/erc-dcc.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 8a40b1454b..2849e25bf7 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -979,17 +979,20 @@ rather than every 1024 byte block, but nobody seems to care."
(let ((inhibit-read-only t)
received-bytes)
(goto-char (point-max))
- (insert (string-make-unibyte str))
+ (if str
+ (insert (string-make-unibyte str)))
(when (> (point-max) erc-dcc-receive-cache)
(erc-dcc-append-contents (current-buffer) erc-dcc-file-name))
- (setq received-bytes (+ (buffer-size) erc-dcc-byte-count))
+ (setq received-bytes (buffer-size))
+ (if erc-dcc-byte-count
+ (setq received-bytes (+ received-bytes erc-dcc-byte-count)))
(and erc-dcc-verbose
(erc-display-message
nil 'notice erc-server-process
'dcc-get-bytes-received
- ?f (file-name-nondirectory buffer-file-name)
+ ?f (file-name-nondirectory (buffer-name))
?b (number-to-string received-bytes)))
(cond
((and (> (plist-get erc-dcc-entry-data :size) 0)
@@ -997,7 +1000,7 @@ rather than every 1024 byte block, but nobody seems to care."
(erc-display-message
nil '(notice error) 'active
'dcc-get-file-too-long
- ?f (file-name-nondirectory buffer-file-name))
+ ?f (file-name-nondirectory (buffer-name)))
(delete-process proc))
(t
(process-send-string
--
2.20.0
Thanks,
Victor
--
Victor J. Orlikowski <> vjo@(ee.|cs.)?duke.edu
next prev parent reply other threads:[~2019-02-10 19:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-03 17:47 [PATCH] Fixes to allow erc-dcc-get-filter to work properly Victor Orlikowski
2019-02-08 7:59 ` Eli Zaretskii
2019-02-08 22:00 ` Victor Orlikowski
2019-02-09 9:49 ` Eli Zaretskii
2019-02-10 16:07 ` Victor Orlikowski
2019-02-10 16:41 ` Eli Zaretskii
2019-02-10 19:02 ` Victor Orlikowski
2019-02-10 19:14 ` Victor Orlikowski [this message]
2019-02-15 8:18 ` [PATCH] v2: " Eli Zaretskii
2019-02-17 18:57 ` Victor Orlikowski
2019-02-17 19:32 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FCFBDED-9040-41B1-9686-30773CA6EC08.notmuch@neverland \
--to=vjo@duke.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.