all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#43573: 26.1; set-process-buffer doesn't create a process marker
@ 2020-09-22 19:44 marmot-te
  2020-09-24 15:17 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: marmot-te @ 2020-09-22 19:44 UTC (permalink / raw)
  To: 43573

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2.1: Type: text/plain, Size: 2445 bytes --]


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.
--



[-- Attachment #2.2.1: Type: text/html, Size: 2918 bytes --]

[-- Attachment #3.1: Type: text/html, Size: 6963 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#43573: 26.1; set-process-buffer doesn't create a process marker
  2020-09-22 19:44 bug#43573: 26.1; set-process-buffer doesn't create a process marker marmot-te
@ 2020-09-24 15:17 ` Lars Ingebrigtsen
  2020-10-03 14:13   ` marmot-te
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-24 15:17 UTC (permalink / raw)
  To: marmot-te; +Cc: 43573

marmot-te <marmot-te@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#43573: 26.1; set-process-buffer doesn't create a process marker
  2020-09-24 15:17 ` Lars Ingebrigtsen
@ 2020-10-03 14:13   ` marmot-te
  0 siblings, 0 replies; 3+ messages in thread
From: marmot-te @ 2020-10-03 14:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43573

[-- Attachment #1: Type: text/plain, Size: 950 bytes --]


On Thu, Sep 24 2020, Lars Ingebrigtsen wrote:

> marmot-te <marmot-te@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~~

[-- Attachment #2.1: Type: text/html, Size: 1270 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-03 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-22 19:44 bug#43573: 26.1; set-process-buffer doesn't create a process marker marmot-te
2020-09-24 15:17 ` Lars Ingebrigtsen
2020-10-03 14:13   ` marmot-te

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.