GNU bug report logs - #43573
26.1; set-process-buffer doesn't create a process marker

Previous Next

Package: emacs;

Reported by: marmot-te <marmot-te <at> riseup.net>

Date: Tue, 22 Sep 2020 21:48:02 UTC

Severity: normal

Tags: fixed

Found in version 26.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43573 in the body.
You can then email your comments to 43573 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#43573; Package emacs. (Tue, 22 Sep 2020 21:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to marmot-te <marmot-te <at> riseup.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 22 Sep 2020 21:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: marmot-te <marmot-te <at> riseup.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; set-process-buffer doesn't create a process marker
Date: Tue, 22 Sep 2020 19:44:17 +0000
[Message part 1 (text/plain, inline)]

[Message part 2 (text/plain, inline)]
Hello GNU's wizards,

I noticed that creating a buffer for a process with ~set-process-buffer~
does not create also a marker specific to that process that can be
retrieved with ~process-mark~ afteward.

While the documentation doesn't imply it, and it not something
obiously necessary, I still consider it as a bug for
~set-process-buffer~ because I see nowhere a function which can create
such process marker.

Follow the code that trigger this discovery for some context explaining why
one may expect this marker to be created, it is a poor man html server
translated from Common Lisp, in the book “Land of Lisp” by Conrad Barsky.

(make-network-process
   :name "web-server-process"
   :buffer "web-server-buffer"
   :server t
   :service 8080
   :host "127.0.0.1"
   :family 'ipv4
   :filter (lambda (proc string)
             ;; custom filter doesn't create a dedicated buffer.
             ;; process marker is not created whith the process buffer ?
             (let ((stream (set-buffer
                            (set-process-buffer proc
                                                (get-buffer-create (process-name proc))))))
               ;; carriage returns everywhere ...
               (insert (remove ?\C-m string))
               (beginning-of-buffer)
               ;; Unfortunally this filter is applyed only after the sentinel trigger, so
               ;; it seems useless to use sentinel for processing the GET request.
               ;; or should use accept-output-process?
               (let* ((url (parse-url (read-line stream)))
                      (path (car url))
                      (header (get-header stream))
                      (params (append (cdr url)
                                      (get-content-params stream header))))
                 (process-send-string proc
                                      (funcall #'hello-request-handler path header params))
                 (process-send-eof proc)))
             (set-process-query-on-exit-flag proc nil)
             (kill-buffer (process-buffer proc)))
   :log  (lambda (server client message)
           (princ  (format "Client connected : %s\n" client)
                   (process-buffer (get-process server)))))


I did not deliver the functions missing because they are not involved in
the obsevation of the behavior discuted, will do but if you ask.

Freely,
Pillule.
--


[Message part 3 (text/html, inline)]
[Message part 4 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43573; Package emacs. (Thu, 24 Sep 2020 15:18:01 GMT) Full text and rfc822 format available.

Message #8 received at 43573 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: marmot-te <marmot-te <at> riseup.net>
Cc: 43573 <at> debbugs.gnu.org
Subject: Re: bug#43573: 26.1; set-process-buffer doesn't create a process
 marker
Date: Thu, 24 Sep 2020 17:17:44 +0200
marmot-te <marmot-te <at> riseup.net> writes:

> I noticed that creating a buffer for a process with set-process-buffer
> does not create also a marker specific to that process that can be
> retrieved with process-mark afteward.
>
> While the documentation doesn’t imply it, and it not something
> obiously necessary, I still consider it as a bug for
> set-process-buffer because I see nowhere a function which can create
> such process marker.

Yes, pretty odd, but it's just a normal marker, I think, so if you want
it to point somewhere else, you can just use do

(set-marker (process-mark proc) (point-max) buffer)

or something?

However, while there is some potential for breakage here, I think it
makes sense to have set-process-buffer do this, so I've applied it to
Emacs 28.  If this breaks anything (and that is possible -- somebody
could be using `process-mark' as a weird way to keep track of what the
previous buffer was -- it should be reverted.

I think that's very unlikely, but I guess we'll find out.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 24 Sep 2020 15:19:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 43573 <at> debbugs.gnu.org and marmot-te <marmot-te <at> riseup.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 24 Sep 2020 15:19:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43573; Package emacs. (Sat, 03 Oct 2020 14:15:01 GMT) Full text and rfc822 format available.

Message #15 received at 43573 <at> debbugs.gnu.org (full text, mbox):

From: marmot-te <marmot-te <at> riseup.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43573 <at> debbugs.gnu.org
Subject: Re: bug#43573: 26.1;
 set-process-buffer doesn't create a process marker
Date: Sat, 03 Oct 2020 14:13:49 +0000
[Message part 1 (text/plain, inline)]
On Thu, Sep 24 2020, Lars Ingebrigtsen wrote:

> marmot-te <marmot-te <at> riseup.net> writes:
>
>> I noticed that creating a buffer for a process with set-process-buffer
>> does not create also a marker specific to that process that can be
>> retrieved with process-mark afteward.
>
> Yes, pretty odd, but it's just a normal marker, I think, so if you want
> it to point somewhere else, you can just use do
>
> (set-marker (process-mark proc) (point-max) buffer)

Now I see it it feels so obvious :)

> However, while there is some potential for breakage here, I think it
> makes sense to have set-process-buffer do this, so I've applied it to
> Emacs 28.  If this breaks anything (and that is possible -- somebody
> could be using `process-mark' as a weird way to keep track of what the
> previous buffer was -- it should be reverted.
>
> I think that's very unlikely, but I guess we'll find out.

Ok, thanks you !

--
<:3nn~~
   <:3nn~~
      <:3nn~~
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 01 Nov 2020 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.