This is my patch patch.1n for perl5.001.
[p5sagit/p5-mst-13.2.git] / emacs / emacs19
1 Article 15041 of comp.lang.perl:
2 Path: netlabs!news.cerf.net!usc!sol.ctr.columbia.edu!news.kei.com!bloom-beacon.mit.edu!paperboy.osf.org!meissner
3 From: meissner@osf.org (Michael Meissner)
4 Newsgroups: comp.lang.perl
5 Subject: Re: question on using perldb.el  with emacs
6 Date: 17 Oct 1993 21:10:21 GMT
7 Organization: Open Software Foundation
8 Lines: 297
9 Message-ID: <MEISSNER.93Oct17171021@pasta.osf.org>
10 References: <BSHAW.93Oct17143524@bobasun.spdc.ti.com>
11 NNTP-Posting-Host: pasta.osf.org
12 In-reply-to: bshaw@bobasun.spdc.ti.com's message of Sun, 17 Oct 1993 19:35:24 GMT
13
14 In article <BSHAW.93Oct17143524@bobasun.spdc.ti.com> bshaw@bobasun.spdc.ti.com
15 (Bob Shaw) writes:
16
17 | Hi folks
18
19 | Say, I'm trying to use perldb with emacs.  I can invoke perldb 
20 | within emacs ok and get the window *perldb-foo*  but when it asks
21 | for "additional command line arguments" , no matter what I give it
22 | I get the error message   Symbol's function definition is void:  make-
23 | shell.
24
25 | The debugger , by itself, works fine but wanted to try out perldb in
26 | emacs.
27
28 This is a symptom of using Emacs 19.xx with perldb.el which was originally made
29 for emacs version 18.xx.  You can either install the emacs19 replacement for
30 perldb that hooks it in with GUD (grand unified debugger), or apply the patches
31 that I picked off of the net (I use the perldb replacement that uses GUD
32 myself):
33
34 #!/bin/sh
35 # This is a shell archive (produced by shar 3.49)
36 # To extract the files from this archive, save it to a file, remove
37 # everything above the "!/bin/sh" line above, and type "sh file_name".
38 #
39 # made 10/17/1993 21:07 UTC by meissner@pasta.osf.org
40 # Source directory /usr/users/meissner/elisp
41 #
42 # existing files will NOT be overwritten unless -c is specified
43 #
44 # This shar contains:
45 # length  mode       name
46 # ------ ---------- ------------------------------------------
47 #   4761 -rw-r--r-- emacs19-perldb.el
48 #   3845 -rw-rw-r-- emacs19-perldb.patches
49 #
50 # ============= emacs19-perldb.el ==============
51 if test -f 'emacs19-perldb.el' -a X"$1" != X"-c"; then
52         echo 'x - skipping emacs19-perldb.el (File already exists)'
53 else
54 echo 'x - extracting emacs19-perldb.el (Text)'
55 sed 's/^X//' << 'SHAR_EOF' > 'emacs19-perldb.el' &&
56 X;; Author : Stephane Boucher
57 X;; Note : This is an add on for gud (Part of GNU Emacs 19). It is
58 X;;        derived from the gdb section that is part of gud.
59 X
60 X;; Copyright (C) 1993 Stephane Boucher.
61 X
62 X;; Perldb is free software; you can redistribute it and/or modify
63 X;; it under the terms of the GNU General Public License as published by
64 X;; the Free Software Foundation; either version 2, or (at your option)
65 X;; any later version.
66 X
67 X;; Perldb Emacs is distributed in the hope that it will be useful,
68 X;; but WITHOUT ANY WARRANTY; without even the implied warranty of
69 X;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
70 X;; GNU General Public License for more details.
71 X
72 X;; You should have received a copy of the GNU General Public License
73 X;; along with GNU Emacs; see the file COPYING.  If not, write to
74 X;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
75 X
76 X(require 'gud)
77 X
78 X;; ======================================================================
79 X;; perldb functions
80 X
81 X;;; History of argument lists passed to perldb.
82 X(defvar gud-perldb-history nil)
83 X
84 X(defun gud-perldb-massage-args (file args)
85 X  (cons "-d" (cons file (cons "-emacs" args))))
86 X
87 X;; There's no guarantee that Emacs will hand the filter the entire
88 X;; marker at once; it could be broken up across several strings.  We
89 X;; might even receive a big chunk with several markers in it.  If we
90 X;; receive a chunk of text which looks like it might contain the
91 X;; beginning of a marker, we save it here between calls to the
92 X;; filter.
93 X(defvar gud-perldb-marker-acc "")
94 X
95 X(defun gud-perldb-marker-filter (string)
96 X  (save-match-data
97 X    (setq gud-perldb-marker-acc (concat gud-perldb-marker-acc string))
98 X    (let ((output ""))
99 X
100 X      ;; Process all the complete markers in this chunk.
101 X      (while (string-match "^\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
102 X                          gud-perldb-marker-acc)
103 X       (setq
104 X
105 X        ;; Extract the frame position from the marker.
106 X        gud-last-frame
107 X        (cons (substring gud-perldb-marker-acc (match-beginning 1) (match-end 1))
108 X              (string-to-int (substring gud-perldb-marker-acc
109 X                                        (match-beginning 2)
110 X                                        (match-end 2))))
111 X
112 X        ;; Append any text before the marker to the output we're going
113 X        ;; to return - we don't include the marker in this text.
114 X        output (concat output
115 X                       (substring gud-perldb-marker-acc 0 (match-beginning 0)))
116 X
117 X        ;; Set the accumulator to the remaining text.
118 X        gud-perldb-marker-acc (substring gud-perldb-marker-acc (match-end 0))))
119 X
120 X      ;; Does the remaining text look like it might end with the
121 X      ;; beginning of another marker?  If it does, then keep it in
122 X      ;; gud-perldb-marker-acc until we receive the rest of it.  Since we
123 X      ;; know the full marker regexp above failed, it's pretty simple to
124 X      ;; test for marker starts.
125 X      (if (string-match "^\032.*\\'" gud-perldb-marker-acc)
126 X         (progn
127 X           ;; Everything before the potential marker start can be output.
128 X           (setq output (concat output (substring gud-perldb-marker-acc
129 X                                                  0 (match-beginning 0))))
130 X
131 X           ;; Everything after, we save, to combine with later input.
132 X           (setq gud-perldb-marker-acc
133 X                 (substring gud-perldb-marker-acc (match-beginning 0))))
134 X
135 X       (setq output (concat output gud-perldb-marker-acc)
136 X             gud-perldb-marker-acc ""))
137 X
138 X      output)))
139 X
140 X(defun gud-perldb-find-file (f)
141 X  (find-file-noselect f))
142 X
143 X;;;###autoload
144 X(defun perldb (command-line)
145 X  "Run perldb on program FILE in buffer *gud-FILE*.
146 XThe directory containing FILE becomes the initial working directory
147 Xand source-file directory for your debugger."
148 X  (interactive
149 X   (list (read-from-minibuffer "Run perldb (like this): "
150 X                              (if (consp gud-perldb-history)
151 X                                  (car gud-perldb-history)
152 X                                "perl ")
153 X                              nil nil
154 X                              '(gud-perldb-history . 1))))
155 X  (gud-overload-functions '((gud-massage-args . gud-perldb-massage-args)
156 X                           (gud-marker-filter . gud-perldb-marker-filter)
157 X                           (gud-find-file . gud-perldb-find-file)
158 X                           ))
159 X
160 X  (gud-common-init command-line)
161 X
162 X  (gud-def gud-break  "b %l"         "\C-b" "Set breakpoint at current line.")
163 X  (gud-def gud-remove "d %l"         "\C-d" "Remove breakpoint at current line")
164 X  (gud-def gud-step   "s"            "\C-s" "Step one source line with display.")
165 X  (gud-def gud-next   "n"            "\C-n" "Step one line (skip functions).")
166 X  (gud-def gud-cont   "c"            "\C-r" "Continue with display.")
167 X;  (gud-def gud-finish "finish"       "\C-f" "Finish executing current function.")
168 X;  (gud-def gud-up     "up %p"        "<" "Up N stack frames (numeric arg).")
169 X;  (gud-def gud-down   "down %p"      ">" "Down N stack frames (numeric arg).")
170 X  (gud-def gud-print  "%e"           "\C-p" "Evaluate perl expression at point.")
171 X
172 X  (setq comint-prompt-regexp "^  DB<[0-9]+> ")
173 X  (run-hooks 'perldb-mode-hook)
174 X  )
175 SHAR_EOF
176 chmod 0644 emacs19-perldb.el ||
177 echo 'restore of emacs19-perldb.el failed'
178 Wc_c="`wc -c < 'emacs19-perldb.el'`"
179 test 4761 -eq "$Wc_c" ||
180         echo 'emacs19-perldb.el: original size 4761, current size' "$Wc_c"
181 fi
182 # ============= emacs19-perldb.patches ==============
183 if test -f 'emacs19-perldb.patches' -a X"$1" != X"-c"; then
184         echo 'x - skipping emacs19-perldb.patches (File already exists)'
185 else
186 echo 'x - extracting emacs19-perldb.patches (Text)'
187 sed 's/^X//' << 'SHAR_EOF' > 'emacs19-perldb.patches' &&
188 XFrom dmm0t@rincewind.mech.virginia.edu Fri Jul 16 23:17:10 1993
189 XPath: paperboy.osf.org!bloom-beacon.mit.edu!biosci!uwm.edu!ux1.cso.uiuc.edu!howland.reston.ans.net!darwin.sura.net!news-feed-2.peachnet.edu!concert!uvaarpa!murdoch!rincewind.mech.virginia.edu!dmm0t
190 XFrom: dmm0t@rincewind.mech.virginia.edu (David Meyer)
191 XNewsgroups: gnu.emacs.sources
192 XSubject: patches to perldb.el for emacs-19
193 XMessage-ID: <CA7uq9.30J@murdoch.acc.Virginia.EDU>
194 XDate: 15 Jul 93 17:18:07 GMT
195 XSender: usenet@murdoch.acc.Virginia.EDU
196 XOrganization: University of Virginia
197 XLines: 97
198 X
199 X
200 XHere are my patches to perldb.el (the perl debugger mode that comes
201 Xwith perl 4.0xx).  Basically, all I've done is to hack perldb.el to
202 Xuse comint.el stuff rather than the old shell.el stuff (i.e. change
203 Xshell-mode-map to comint-mode-map).
204 X
205 XI've been using my patched version without problem, but if anyone sees
206 Xsomething I've missed, please post or send e-mail.
207 X
208 X                               Thanks,
209 X                                               Dave
210 X
211 X
212 X*** /Users/dmm0t/perldb.el     Thu Jul 15 13:06:59 1993
213 X--- perldb.el  Tue Jul  6 22:24:41 1993
214 X***************
215 X*** 65,71 ****
216 X  
217 X  (if perldb-mode-map
218 X     nil
219 X!   (setq perldb-mode-map (copy-keymap shell-mode-map))
220 X    (define-key perldb-mode-map "\C-l" 'perldb-refresh))
221 X  
222 X  (define-key ctl-x-map " " 'perldb-break)
223 X--- 65,71 ----
224 X  
225 X  (if perldb-mode-map
226 X     nil
227 X!   (setq perldb-mode-map (copy-keymap comint-mode-map))
228 X    (define-key perldb-mode-map "\C-l" 'perldb-refresh))
229 X  
230 X  (define-key ctl-x-map " " 'perldb-break)
231 X***************
232 X*** 122,131 ****
233 X    (setq mode-name "Inferior Perl")
234 X    (setq mode-line-process '(": %s"))
235 X    (use-local-map perldb-mode-map)
236 X!   (make-local-variable 'last-input-start)
237 X!   (setq last-input-start (make-marker))
238 X!   (make-local-variable 'last-input-end)
239 X!   (setq last-input-end (make-marker))
240 X    (make-local-variable 'perldb-last-frame)
241 X    (setq perldb-last-frame nil)
242 X    (make-local-variable 'perldb-last-frame-displayed-p)
243 X--- 122,131 ----
244 X    (setq mode-name "Inferior Perl")
245 X    (setq mode-line-process '(": %s"))
246 X    (use-local-map perldb-mode-map)
247 X!   (make-local-variable 'comint-last-input-start)
248 X!   (setq comint-last-input-start (make-marker))
249 X!   (make-local-variable 'comint-last-input-end)
250 X!   (setq comint-last-input-end (make-marker))
251 X    (make-local-variable 'perldb-last-frame)
252 X    (setq perldb-last-frame nil)
253 X    (make-local-variable 'perldb-last-frame-displayed-p)
254 X***************
255 X*** 134,142 ****
256 X    (setq perldb-delete-prompt-marker nil)
257 X    (make-local-variable 'perldb-filter-accumulator)
258 X    (setq perldb-filter-accumulator nil)
259 X!   (make-local-variable 'shell-prompt-pattern)
260 X!   (setq shell-prompt-pattern perldb-prompt-pattern)
261 X!   (run-hooks 'shell-mode-hook 'perldb-mode-hook))
262 X  
263 X  (defvar current-perldb-buffer nil)
264 X  
265 X--- 134,142 ----
266 X    (setq perldb-delete-prompt-marker nil)
267 X    (make-local-variable 'perldb-filter-accumulator)
268 X    (setq perldb-filter-accumulator nil)
269 X!   (make-local-variable 'comint-prompt-regexp)
270 X!   (setq comint-prompt-regexp perldb-prompt-pattern)
271 X!   (run-hooks 'comint-mode-hook 'perldb-mode-hook))
272 X  
273 X  (defvar current-perldb-buffer nil)
274 X  
275 X***************
276 X*** 189,195 ****
277 X      (setq default-directory dir)
278 X      (or (bolp) (newline))
279 X      (insert "Current directory is " default-directory "\n")
280 X!     (apply 'make-shell
281 X          (concat "perldb-" file) perldb-command-name nil "-d" path "-emacs"
282 X          (parse-args args))
283 X      (perldb-mode)
284 X--- 189,195 ----
285 X      (setq default-directory dir)
286 X      (or (bolp) (newline))
287 X      (insert "Current directory is " default-directory "\n")
288 X!     (apply 'make-comint
289 X          (concat "perldb-" file) perldb-command-name nil "-d" path "-emacs"
290 X          (parse-args args))
291 X      (perldb-mode)
292 X-- 
293 XDavid M. Meyer                             Mechanical & Aerospace Engineering
294 Xdmm0t@rincewind.mech.virginia.edu          University of Virginia
295 XNeXTmail ok
296 X
297 SHAR_EOF
298 chmod 0664 emacs19-perldb.patches ||
299 echo 'restore of emacs19-perldb.patches failed'
300 Wc_c="`wc -c < 'emacs19-perldb.patches'`"
301 test 3845 -eq "$Wc_c" ||
302         echo 'emacs19-perldb.patches: original size 3845, current size' "$Wc_c"
303 fi
304 exit 0
305
306 --
307 Michael Meissner        email: meissner@osf.org         phone: 617-621-8861
308 Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142
309
310 Old hackers never die, their bugs just increase.
311
312