Mercurial > emacs
annotate lisp/ledit.el @ 1717:aa7d6d57504b
* frame.h (struct frame): New fields `can_have_scrollbars' and
`has_vertical_scrollbars'.
(FRAME_CAN_HAVE_SCROLLBARS, FRAME_HAS_VERTICAL_SCROLLBARS): New
accessors, for both the MULTI_FRAME and non-MULTI_FRAME.
(VERTICAL_SCROLLBAR_WIDTH, WINDOW_VERTICAL_SCROLLBAR,
WINDOW_VERTICAL_SCROLLBAR_COLUMN,
WINDOW_VERTICAL_SCROLLBAR_HEIGHT): New macros.
* window.h (struct window): New field `vertical_scrollbar'.
* xterm.h (struct x_display): vertical_scrollbars,
judge_timestamp, vertical_scrollbar_extra: New fields.
(struct scrollbar): New struct.
(VERTICAL_SCROLLBAR_PIXEL_WIDTH, VERTICAL_SCROLLBAR_PIXEL_HEIGHT,
VERTICAL_SCROLLBAR_LEFT_BORDER, VERTICAL_SCROLLBAR_RIGHT_BORDER,
VERTICAL_SCROLLBAR_TOP_BORDER, VERTICAL_SCROLLBAR_BOTTOM_BORDER,
CHAR_TO_PIXEL_WIDTH, CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_WIDTH,
PIXEL_TO_CHAR_HEIGHT): New accessors and macros.
* frame.c (make_frame): Initialize the `can_have_scrollbars' and
`has_vertical_scrollbars' fields of the frame.
* term.c (term_init): Note that TERMCAP terminals don't support
scrollbars.
(mouse_position_hook): Document new args.
(set_vertical_scrollbar_hook, condemn_scrollbars_hook,
redeem_scrollbar_hook, judge_scrollbars_hook): New hooks.
* termhooks.h: Declare and document them.
(enum scrollbar_part): New type.
(struct input_event): Describe the new form of the scrollbar_click
event type. Change `part' from a Lisp_Object to an enum
scrollbar_part. Add a new field `scrollbar'.
* keyboard.c (kbd_buffer_get_event): Pass appropriate new
parameters to *mouse_position_hook, and make_lispy_movement.
* xfns.c (x_set_vertical_scrollbar): New function.
(x_figure_window_size): Use new macros to calculate frame size.
(Fx_create_frame): Note that X Windows frames do support scroll
bars. Default to "yes".
* xterm.c: #include <X11/cursorfont.h> and "window.h".
(x_vertical_scrollbar_cursor): New variable.
(x_term_init): Initialize it.
(last_mouse_bar, last_mouse_bar_frame, last_mouse_part,
last_mouse_scroll_range_start, last_mouse_scroll_range_end): New
variables.
(XTmouse_position): Use them to return scrollbar movement events.
Take new arguments, for that purpose.
(x_window_to_scrollbar, x_scrollbar_create,
x_scrollbar_set_handle, x_scrollbar_remove, x_scrollbar_move,
XTset_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar,
XTjudge_scrollbars, x_scrollbar_expose,
x_scrollbar_background_expose, x_scrollbar_handle_click,
x_scrollbar_handle_motion): New functions to implement scrollbars.
(x_term_init): Set the termhooks.h hooks to point to them.
(x_set_window_size): Use new macros to calculate frame size. Set
vertical_scrollbar_extra field.
(x_make_frame_visible): Use the frame accessor
FRAME_HAS_VERTICAL_SCROLLBARS to decide if we need to map the
frame's subwindows as well.
(XTread_socket): Use new size-calculation macros from xterm.h when
processing ConfigureNotify events.
(x_wm_set_size_hint): Use PIXEL_TO_CHAR_WIDTH and
PIXEL_TO_CHAR_HEIGHT macros.
* ymakefile (xdisp.o): This now depends on termhooks.h.
(xterm.o): This now depends on window.h.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Thu, 24 Dec 1992 06:17:18 +0000 |
| parents | 9f3cc03dae67 |
| children | 10e417efb12a |
| rev | line source |
|---|---|
|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
269
diff
changeset
|
1 ;;; ledit.el --- Emacs side of ledit interface |
|
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
269
diff
changeset
|
2 |
|
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
3 ;; Copyright (C) 1985 Free Software Foundation, Inc. |
|
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
4 |
|
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
5 ;; Maintainer: FSF |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keyord: languages |
|
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
7 |
| 36 | 8 ;; This file is part of GNU Emacs. |
| 9 | |
| 10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
| 11 ;; it under the terms of the GNU General Public License as published by | |
|
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
| 36 | 13 ;; any later version. |
| 14 | |
| 15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
| 16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 ;; GNU General Public License for more details. | |
| 19 | |
| 20 ;; You should have received a copy of the GNU General Public License | |
| 21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
| 22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 23 | |
|
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
24 ;;; Code: |
| 36 | 25 |
| 26 ;;; To do: | |
| 27 ;;; o lisp -> emacs side of things (grind-definition and find-definition) | |
| 28 | |
| 29 (defvar ledit-mode-map nil) | |
| 30 | |
| 31 (defconst ledit-zap-file (concat "/tmp/" (user-login-name) ".l1") | |
| 32 "File name for data sent to Lisp by Ledit.") | |
| 33 (defconst ledit-read-file (concat "/tmp/" (user-login-name) ".l2") | |
| 34 "File name for data sent to Ledit by Lisp.") | |
| 35 (defconst ledit-compile-file | |
| 36 (concat "/tmp/" (user-login-name) ".l4") | |
| 37 "File name for data sent to Lisp compiler by Ledit.") | |
| 38 (defconst ledit-buffer "*LEDIT*" | |
| 39 "Name of buffer in which Ledit accumulates data to send to Lisp.") | |
| 256 | 40 |
| 269 | 41 ;;;###autoload |
| 42 (defconst ledit-save-files t "\ | |
| 43 *Non-nil means Ledit should save files before transferring to Lisp.") | |
| 44 ;;;###autoload | |
| 45 (defconst ledit-go-to-lisp-string "%?lisp" "\ | |
| 46 *Shell commands to execute to resume Lisp job.") | |
| 47 ;;;###autoload | |
| 48 (defconst ledit-go-to-liszt-string "%?liszt" "\ | |
| 49 *Shell commands to execute to resume Lisp compiler job.") | |
| 36 | 50 |
| 51 (defun ledit-save-defun () | |
| 52 "Save the current defun in the ledit buffer" | |
| 53 (interactive) | |
| 54 (save-excursion | |
| 55 (end-of-defun) | |
| 56 (let ((end (point))) | |
| 57 (beginning-of-defun) | |
| 58 (append-to-buffer ledit-buffer (point) end)) | |
| 59 (message "Current defun saved for Lisp"))) | |
| 60 | |
| 61 (defun ledit-save-region (beg end) | |
| 62 "Save the current region in the ledit buffer" | |
| 63 (interactive "r") | |
| 64 (append-to-buffer ledit-buffer beg end) | |
| 65 (message "Region saved for Lisp")) | |
| 66 | |
| 67 (defun ledit-zap-defun-to-lisp () | |
| 214 | 68 "Carry the current defun to Lisp." |
| 36 | 69 (interactive) |
| 70 (ledit-save-defun) | |
| 71 (ledit-go-to-lisp)) | |
| 72 | |
| 73 (defun ledit-zap-defun-to-liszt () | |
| 214 | 74 "Carry the current defun to liszt." |
| 36 | 75 (interactive) |
| 76 (ledit-save-defun) | |
| 77 (ledit-go-to-liszt)) | |
| 78 | |
| 79 (defun ledit-zap-region-to-lisp (beg end) | |
| 214 | 80 "Carry the current region to Lisp." |
| 36 | 81 (interactive "r") |
| 82 (ledit-save-region beg end) | |
| 83 (ledit-go-to-lisp)) | |
| 84 | |
| 85 (defun ledit-go-to-lisp () | |
| 86 "Suspend Emacs and restart a waiting Lisp job." | |
| 87 (interactive) | |
| 88 (if ledit-save-files | |
| 89 (save-some-buffers)) | |
| 90 (if (get-buffer ledit-buffer) | |
| 91 (save-excursion | |
| 92 (set-buffer ledit-buffer) | |
| 93 (goto-char (point-min)) | |
| 94 (write-region (point-min) (point-max) ledit-zap-file) | |
| 95 (erase-buffer))) | |
| 96 (suspend-emacs ledit-go-to-lisp-string) | |
| 97 (load ledit-read-file t t)) | |
| 98 | |
| 99 (defun ledit-go-to-liszt () | |
| 100 "Suspend Emacs and restart a waiting Liszt job." | |
| 101 (interactive) | |
| 102 (if ledit-save-files | |
| 103 (save-some-buffers)) | |
| 104 (if (get-buffer ledit-buffer) | |
| 105 (save-excursion | |
| 106 (set-buffer ledit-buffer) | |
| 107 (goto-char (point-min)) | |
| 108 (insert "(declare (macros t))\n") | |
| 109 (write-region (point-min) (point-max) ledit-compile-file) | |
| 110 (erase-buffer))) | |
| 111 (suspend-emacs ledit-go-to-liszt-string) | |
| 112 (load ledit-read-file t t)) | |
| 113 | |
| 114 (defun ledit-setup () | |
| 214 | 115 "Set up key bindings for the Lisp/Emacs interface." |
| 36 | 116 (if (not ledit-mode-map) |
| 923 | 117 (progn (setq ledit-mode-map (nconc (make-sparse-keymap) |
| 118 shared-lisp-mode-map)))) | |
| 36 | 119 (define-key ledit-mode-map "\e\^d" 'ledit-save-defun) |
| 120 (define-key ledit-mode-map "\e\^r" 'ledit-save-region) | |
| 121 (define-key ledit-mode-map "\^xz" 'ledit-go-to-lisp) | |
| 122 (define-key ledit-mode-map "\e\^c" 'ledit-go-to-liszt)) | |
| 123 | |
| 124 (ledit-setup) | |
| 125 | |
| 256 | 126 ;;;###autoload |
| 36 | 127 (defun ledit-mode () |
| 214 | 128 "\\<ledit-mode-map>Major mode for editing text and stuffing it to a Lisp job. |
| 36 | 129 Like Lisp mode, plus these special commands: |
| 214 | 130 \\[ledit-save-defun] -- record defun at or after point |
| 36 | 131 for later transmission to Lisp job. |
| 214 | 132 \\[ledit-save-region] -- record region for later transmission to Lisp job. |
| 133 \\[ledit-go-to-lisp] -- transfer to Lisp job and transmit saved text. | |
| 134 \\[ledit-go-to-liszt] -- transfer to Liszt (Lisp compiler) job | |
| 36 | 135 and transmit saved text. |
| 136 \\{ledit-mode-map} | |
| 137 To make Lisp mode automatically change to Ledit mode, | |
| 138 do (setq lisp-mode-hook 'ledit-from-lisp-mode)" | |
| 139 (interactive) | |
| 140 (lisp-mode) | |
| 141 (ledit-from-lisp-mode)) | |
| 142 | |
| 256 | 143 ;;;###autoload |
| 36 | 144 (defun ledit-from-lisp-mode () |
| 145 (use-local-map ledit-mode-map) | |
| 146 (setq mode-name "Ledit") | |
| 147 (setq major-mode 'ledit-mode) | |
| 148 (run-hooks 'ledit-mode-hook)) | |
|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
269
diff
changeset
|
149 |
|
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
269
diff
changeset
|
150 ;;; ledit.el ends here |
