annotate lisp/emacs-lisp/tq.el @ 83004:7900111db01c

Converted display hooks to be display-local. Plus many bugfixes. lib-src/emacsclient.c (window_change_signal): Renamed to pass_signal_to_emacs. (init_signal): Pass SIGINT and SIGQUIT to the emacs process. lisp/faces.el (face-valid-attribute-values): Use the window-system function, not the variable. (read-face-attribute, face-spec-set-match-display, frame-set-background-mode) (face-set-after-frame-default): Ditto. lisp/frame.el (make-frame-on-tty): Added interactive declaration (suggested by Robert J. Chassell). Use tty-create-frame-with-faces, not make-terminal-frame. src/termhooks.h (struct display_method): Renamed to display for brevity. (struct display): Added all display hook variables as members of this structure. Added next_display, reference_count, type and display_info components. (FRAME_MUST_WRITE_SPACES, FRAME_FAST_CLEAR_END_OF_LINE, FRAME_LINE_INS_DEL_OK) (FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK, FRAME_SCROLL_REGION_COST) (FRAME_MEMORY_BELOW_FRAME, FRAME_RIF): Updated for struct display. (FRAME_DISPLAY): New macro. (create_display, delete_display): New prototypes. src/frame.h (struct frame): Added `display' member, removed display_method. (FRAME_LIVE_P): Look at f->display, not f->output_data. src/termchar.h (struct tty_display_info): Removed display_method component. (FRAME_TTY): Use the display structure, not output_data. src/term.c (display_list): New variable. (cursor_to_hook, raw_cursor_to_hook, clear_to_end_hook, clear_frame_hook) (clear_end_of_line_hook, ins_del_lines_hook, delete_glyphs_hook) (ring_bell_hook, reset_terminal_modes_hook, set_terminal_modes_hook) (update_begin_hook, update_end_hook, set_terminal_window_hook) (insert_glyphs_hook, write_glyphs_hook, delete_glyphs_hoo, read_socket_hook) (frame_up_to_date_hook, mouse_position_hook, frame_rehighlight_hook) (frame_raise_lower_hook, set_vertical_scroll_bar_hook, condemn_scroll_bars_hook) (redeem_scroll_bar_hook, judge_scroll_bars_hook): Moved to struct display. (tty_display_method_template): Removed. (syms_of_term): Don't initialize tty_display_method_template. (ring_bell, set_terminal_modes, reset_terminal_modes, update_begin) (update_end, set_terminal_window, cursor_to, raw_cursor_to, clear_to_end) (clear_frame, clear_end_of_line, write_glyphs, insert_glyphs) (delete_glyphs, ins_del_lines): Access display hooks through the frame pointer. (Ftty_display_color_p): Use the frame given as a parameter, or else return nil. (Ftty_display_color_cells): Ditto. (get_named_tty): Renamed to get_named_tty_display, changed return type to struct display. (term_dummy_init): Renamed to initial_term_init. Create and return an initial display. (term_init): Initialize a new struct display and return a pointer to it instead of tty_display_info. Removed frame initialization kludge. (Fdelete_tty): Updated for struct display. (delete_tty): The parameter type is now struct display, not tty_display_info. Delete the display, too. (create_tty_output): New function for creating tty_output structures. (delete_tty_output): New function for deleting tty_output structures. (create_display): New function for creating and registering display structures. (delete_display): New function for deleting and unregistering display structures. src/dispextern.h: Updated prototypes. src/dispnew.c: Include frame.h before termhooks.h. (init_display): Updated term_init call to new signature. src/emacs.c: Include frame.h (for termhooks.h). src/keymap.c: Ditto. src/lread.c: Ditto. src/xsmfns.c: Ditto. src/process.c: Include frame.h before termhooks.h. src/frame.c (Fwindow_system): New function. (syms_of_frame): Initialize it. (make_terminal_frame): Open the terminal device before creating the new frame. Disable scrollbars here, term_init cannot do that anymore. (Fdelete_frame): Use the new delete_frame_hook, don't do display-specific frame deletion here. Ditto for delete_display_hook. (Fmouse_position, Fmouse_pixel_position, Fraise_frame, Flower_frame) (Fredirect_frame_focus): Access display hooks through the frame pointer. src/keyboard.c: Include frame.h before termhooks.h. (start_polling, input_polling_used, stop_polling, gobble_input): Ignore read_socket_hook. (kbd_buffer_get_event, Fset_input_mode): Access display hooks through the frame pointer. (read_avail_input): Loop through all display devices for and call all read_socket_hook functions. Check ttys even if read_socket_hook returned an error. src/sysdep.c (discard_tty_input): Ignore read_socket_hook. (stuff_char): Don't do anything if the current frame is not on a termcap display. (request_sigio, unrequest_sigio): Ignore read_socket_hook. (init_sys_modes): Always call narrow_foreground_group. Set up terminal modes and sigio even under X. src/xdisp.c (message2_nolog, message3_nolog, redisplay_internal) (set_vertical_scroll_bar, redisplay_window): Access display hooks through the frame pointer. (echo_area_display): Don't be afraid of termcap frames during an X+tty combo session. src/xfaces.c: Include termhooks.h. (Ftty_supports_face_attributes_p): Use the given frame, not selected_frame. src/xfns.c (x_set_scroll_bar_foreground, x_set_scroll_bar_background): Access display hooks through the frame pointer. (Fx_create_frame, x_create_tip_frame): Initialize the frame's display structure. src/xmenu.c: Include termhooks.h after frame.h. src/xselect.c (x_own_selection, some_frame_on_display, x_get_foreign_selection) (Fx_disown_selection_internal, Fx_get_cut_buffer_internal) (Fx_store_cut_buffer_internal, Fx_rotate_cut_buffers_internal): Don't do anything if the selected frame is not an X frame. src/xterm.c (x_display_method): Removed. (x_create_frame_display, x_delete_frame_display): New functions for handling struct display objects. (x_term_init): Set up a new struct display object, too. (x_delete_display): Delete the struct display corresponding to the X display. (x_initialize): Moved hook initialization to x_create_frame_display. src/xterm.h (x_display_method): Removed. (struct x_display_info): Added frame_display component. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-44
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 05 Jan 2004 05:54:35 +0000
parents 04f194e85b4d
children 18a818a2ee7c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1 ;;; tq.el --- utility to maintain a transaction queue
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
52493
04f194e85b4d (tq-create): Fix mixed up unquote style.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 52401
diff changeset
3 ;; Copyright (C) 1985, 1986, 1987, 1992, 2003 Free Software Foundation, Inc.
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
783
59dc833c4e0c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 743
diff changeset
5 ;; Author: Scott Draves <spot@cs.cmu.edu>
39461
d9207f337e2d Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 20693
diff changeset
6 ;; Maintainer: FSF
783
59dc833c4e0c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 743
diff changeset
7 ;; Adapted-By: ESR
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 783
diff changeset
8 ;; Keywords: extensions
783
59dc833c4e0c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 743
diff changeset
9
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
10 ;; This file is part of GNU Emacs.
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
11
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
15 ;; any later version.
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
16
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
20 ;; GNU General Public License for more details.
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
21
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
22 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11815
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11815
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11815
diff changeset
25 ;; Boston, MA 02111-1307, USA.
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
26
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
27 ;;; Commentary:
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39568
diff changeset
28
39568
e67950065cf9 Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents: 39461
diff changeset
29 ;; manages receiving a stream asynchronously,
e67950065cf9 Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents: 39461
diff changeset
30 ;; parsing it into transactions, and then calling
e67950065cf9 Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents: 39461
diff changeset
31 ;; handler functions
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
32
39568
e67950065cf9 Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents: 39461
diff changeset
33 ;; Our basic structure is the queue/process/buffer triple. Each entry
e67950065cf9 Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents: 39461
diff changeset
34 ;; of the queue is a regexp/closure/function triple. We buffer
e67950065cf9 Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents: 39461
diff changeset
35 ;; bytes from the process until we see the regexp at the head of the
e67950065cf9 Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents: 39461
diff changeset
36 ;; queue. Then we call the function with the closure and the
e67950065cf9 Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents: 39461
diff changeset
37 ;; collected bytes.
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
38
783
59dc833c4e0c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 743
diff changeset
39 ;;; Code:
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
40
1187
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
41 ;;;###autoload
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
42 (defun tq-create (process)
1187
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
43 "Create and return a transaction queue communicating with PROCESS.
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
44 PROCESS should be a subprocess capable of sending and receiving
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
45 streams of bytes. It may be a local process, or it may be connected
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
46 to a tcp server on another machine."
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
47 (let ((tq (cons nil (cons process
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
48 (generate-new-buffer
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
49 (concat " tq-temp-"
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
50 (process-name process)))))))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
51 (set-process-filter process
49851
fec321336b72 (tq-create): Fix quoted lambda.
Juanma Barranquero <lekktu@gmail.com>
parents: 49598
diff changeset
52 `(lambda (proc string)
52493
04f194e85b4d (tq-create): Fix mixed up unquote style.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 52401
diff changeset
53 (tq-filter ',tq string)))
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
54 tq))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
55
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
56 ;;; accessors
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
57 (defun tq-queue (tq) (car tq))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
58 (defun tq-process (tq) (car (cdr tq)))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
59 (defun tq-buffer (tq) (cdr (cdr tq)))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
60
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
61 (defun tq-queue-add (tq re closure fn)
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
62 (setcar tq (nconc (tq-queue tq)
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
63 (cons (cons re (cons closure fn)) nil)))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
64 'ok)
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
65
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
66 (defun tq-queue-head-regexp (tq) (car (car (tq-queue tq))))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
67 (defun tq-queue-head-fn (tq) (cdr (cdr (car (tq-queue tq)))))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
68 (defun tq-queue-head-closure (tq) (car (cdr (car (tq-queue tq)))))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
69 (defun tq-queue-empty (tq) (not (tq-queue tq)))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
70 (defun tq-queue-pop (tq) (setcar tq (cdr (car tq))) (null (car tq)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 39568
diff changeset
71
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
72
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
73 ;;; must add to queue before sending!
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
74 (defun tq-enqueue (tq question regexp closure fn)
1187
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
75 "Add a transaction to transaction queue TQ.
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
76 This sends the string QUESTION to the process that TQ communicates with.
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
77 When the corresponding answer comes back, we call FN
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
78 with two arguments: CLOSURE, and the answer to the question.
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
79 REGEXP is a regular expression to match the entire answer;
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
80 that's how we tell where the answer ends."
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
81 (tq-queue-add tq regexp closure fn)
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
82 (process-send-string (tq-process tq) question))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
83
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
84 (defun tq-close (tq)
1187
519c04d69cdc Doc fixes. Make tq-create autoload.
Richard M. Stallman <rms@gnu.org>
parents: 841
diff changeset
85 "Shut down transaction queue TQ, terminating the process."
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
86 (delete-process (tq-process tq))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
87 (kill-buffer (tq-buffer tq)))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
88
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
89 (defun tq-filter (tq string)
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
90 "Append STRING to the TQ's buffer; then process the new data."
20693
b48b8060e70d (tq-filter): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17216
diff changeset
91 (with-current-buffer (tq-buffer tq)
b48b8060e70d (tq-filter): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17216
diff changeset
92 (goto-char (point-max))
b48b8060e70d (tq-filter): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17216
diff changeset
93 (insert string)
b48b8060e70d (tq-filter): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 17216
diff changeset
94 (tq-process-buffer tq)))
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
95
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
96 (defun tq-process-buffer (tq)
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
97 "Check TQ's buffer for the regexp at the head of the queue."
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
98 (set-buffer (tq-buffer tq))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
99 (if (= 0 (buffer-size)) ()
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
100 (if (tq-queue-empty tq)
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
101 (let ((buf (generate-new-buffer "*spurious*")))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
102 (copy-to-buffer buf (point-min) (point-max))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
103 (delete-region (point-min) (point))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
104 (pop-to-buffer buf nil)
14430
408eeedc18cd (tq-process-buffer): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
105 (error "Spurious communication from process %s, see buffer %s"
408eeedc18cd (tq-process-buffer): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
106 (process-name (tq-process tq))
408eeedc18cd (tq-process-buffer): Fix error format string.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
107 (buffer-name buf)))
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
108 (goto-char (point-min))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
109 (if (re-search-forward (tq-queue-head-regexp tq) nil t)
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
110 (let ((answer (buffer-substring (point-min) (point))))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
111 (delete-region (point-min) (point))
17216
ef3033d89075 (tq-process-buffer): Catch errors running tq-queue-head-fn.
Richard M. Stallman <rms@gnu.org>
parents: 16235
diff changeset
112 (unwind-protect
ef3033d89075 (tq-process-buffer): Catch errors running tq-queue-head-fn.
Richard M. Stallman <rms@gnu.org>
parents: 16235
diff changeset
113 (condition-case nil
ef3033d89075 (tq-process-buffer): Catch errors running tq-queue-head-fn.
Richard M. Stallman <rms@gnu.org>
parents: 16235
diff changeset
114 (funcall (tq-queue-head-fn tq)
ef3033d89075 (tq-process-buffer): Catch errors running tq-queue-head-fn.
Richard M. Stallman <rms@gnu.org>
parents: 16235
diff changeset
115 (tq-queue-head-closure tq)
ef3033d89075 (tq-process-buffer): Catch errors running tq-queue-head-fn.
Richard M. Stallman <rms@gnu.org>
parents: 16235
diff changeset
116 answer)
ef3033d89075 (tq-process-buffer): Catch errors running tq-queue-head-fn.
Richard M. Stallman <rms@gnu.org>
parents: 16235
diff changeset
117 (error nil))
ef3033d89075 (tq-process-buffer): Catch errors running tq-queue-head-fn.
Richard M. Stallman <rms@gnu.org>
parents: 16235
diff changeset
118 (tq-queue-pop tq))
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
119 (tq-process-buffer tq))))))
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
120
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
121 (provide 'tq)
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
122
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49851
diff changeset
123 ;;; arch-tag: 65dea08c-4edd-4cde-83a5-e8a15b993b79
743
4c88459587e3 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
124 ;;; tq.el ends here