comparison lisp/calc/calc-maint.el @ 41047:73f364fd8aaa

Style cleanup; don't put closing parens on their own line, add "foo.el ends here" to each file, and update copyright date.
author Colin Walters <walters@gnu.org>
date Wed, 14 Nov 2001 09:09:09 +0000
parents 2fb9d407ae73
children fcd507927105
comparison
equal deleted inserted replaced
41046:14b73d89514a 41047:73f364fd8aaa
1 ;; Calculator for GNU Emacs, maintenance routines 1 ;; Calculator for GNU Emacs, maintenance routines
2 ;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. 2 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
3 ;; Written by Dave Gillespie, daveg@synaptics.com. 3 ;; Written by Dave Gillespie, daveg@synaptics.com.
4 4
5 ;; This file is part of GNU Emacs. 5 ;; This file is part of GNU Emacs.
6 6
7 ;; GNU Emacs is distributed in the hope that it will be useful, 7 ;; GNU Emacs is distributed in the hope that it will be useful,
40 (fset 'message (symbol-function 'calc-compile-message)) 40 (fset 'message (symbol-function 'calc-compile-message))
41 (fset 'write-region (symbol-function 'calc-compile-write-region)) 41 (fset 'write-region (symbol-function 'calc-compile-write-region))
42 (calc-do-compile)) 42 (calc-do-compile))
43 (fset 'message old-message) 43 (fset 'message old-message)
44 (fset 'write-region old-write-region))) 44 (fset 'write-region old-write-region)))
45 (calc-do-compile)) 45 (calc-do-compile)))
46 )
47 46
48 (defun calc-do-compile () 47 (defun calc-do-compile ()
49 (let ((make-backup-files nil) 48 (let ((make-backup-files nil)
50 (changed-rules nil) 49 (changed-rules nil)
51 (changed-units nil) 50 (changed-units nil)
131 (insert "\n(defun calc-" v " () '" 130 (insert "\n(defun calc-" v " () '"
132 (prin1-to-string val) ")\n")))) 131 (prin1-to-string val) ")\n"))))
133 (sort rules 'string<)) 132 (sort rules 'string<))
134 (save-buffer)))) 133 (save-buffer))))
135 (error (message "Unable to pre-build tables %s" err)))) 134 (error (message "Unable to pre-build tables %s" err))))
136 (message "Done. Don't forget to install with \"make public\" or \"make private\".")) 135 (message "Done. Don't forget to install with \"make public\" or \"make private\".")))
137 )
138 136
139 (defun calc-compile-message (fmt &rest args) 137 (defun calc-compile-message (fmt &rest args)
140 (cond ((and (= (length args) 2) 138 (cond ((and (= (length args) 2)
141 (stringp (car args)) 139 (stringp (car args))
142 (string-match ".elc?\\'" (car args)) 140 (string-match ".elc?\\'" (car args))
164 (funcall old-message fmt (file-name-nondirectory (car args))))) 162 (funcall old-message fmt (file-name-nondirectory (car args)))))
165 ((string-match "\\(Preparing\\|Building\\).*\\.\\.\\.$" fmt) 163 ((string-match "\\(Preparing\\|Building\\).*\\.\\.\\.$" fmt)
166 (send-string-to-terminal (apply 'format fmt args))) 164 (send-string-to-terminal (apply 'format fmt args)))
167 ((string-match "\\(Preparing\\|Building\\).*\\.\\.\\. *done$" fmt) 165 ((string-match "\\(Preparing\\|Building\\).*\\.\\.\\. *done$" fmt)
168 (send-string-to-terminal "done\n")) 166 (send-string-to-terminal "done\n"))
169 (t (apply old-message fmt args))) 167 (t (apply old-message fmt args))))
170 )
171 168
172 (defun calc-compile-write-region (start end filename &optional append visit &rest rest) 169 (defun calc-compile-write-region (start end filename &optional append visit &rest rest)
173 (if (eq visit t) 170 (if (eq visit t)
174 (set-buffer-auto-saved)) 171 (set-buffer-auto-saved))
175 (if (and (string-match "\\.elc" filename) 172 (if (and (string-match "\\.elc" filename)
180 (if (search-forward "\n(require (quote calc-macs))\n" nil t) 177 (if (search-forward "\n(require (quote calc-macs))\n" nil t)
181 (replace-match "")) 178 (replace-match ""))
182 (setq end (point-max)))) 179 (setq end (point-max))))
183 (apply old-write-region start end filename append 'quietly rest) 180 (apply old-write-region start end filename append 'quietly rest)
184 (message "Wrote %s" filename) 181 (message "Wrote %s" filename)
185 nil 182 nil)
186 )
187 183
188 184
189 185
190 (defun calc-split-tutorial (&optional force) 186 (defun calc-split-tutorial (&optional force)
191 (interactive "P") 187 (interactive "P")
239 (save-buffer))) 235 (save-buffer)))
240 (switch-to-buffer srcbuf) 236 (switch-to-buffer srcbuf)
241 (goto-char 1)) 237 (goto-char 1))
242 (message (cond ((eq part 1) "Wrote file calctut.tex") 238 (message (cond ((eq part 1) "Wrote file calctut.tex")
243 ((eq part 2) "Wrote file calcref.tex") 239 ((eq part 2) "Wrote file calcref.tex")
244 (t "Wrote files calctut.tex and calcref.tex"))) 240 (t "Wrote files calctut.tex and calcref.tex"))))
245 )
246 241
247 (defun calc-split-volume (number fix name other-name) 242 (defun calc-split-volume (number fix name other-name)
248 (goto-char 1) 243 (goto-char 1)
249 (search-forward "@c [title]\n") 244 (search-forward "@c [title]\n")
250 (search-forward "Manual") 245 (search-forward "Manual")
268 (forward-line 1))) 263 (forward-line 1)))
269 (goto-char 1) 264 (goto-char 1)
270 (while (search-forward "@c [not-split]\n" nil t) 265 (while (search-forward "@c [not-split]\n" nil t)
271 (while (not (looking-at "@c")) 266 (while (not (looking-at "@c"))
272 (insert "@c ") 267 (insert "@c ")
273 (forward-line 1))) 268 (forward-line 1))))
274 )
275 269
276 270
277 (defun calc-inline-summary () 271 (defun calc-inline-summary ()
278 "Make a special \"calcsum.tex\" file to be used with main manual." 272 "Make a special \"calcsum.tex\" file to be used with main manual."
279 (calc-split-summary nil t) 273 (calc-split-summary nil t))
280 )
281 274
282 (defun calc-split-summary (&optional force in-line) 275 (defun calc-split-summary (&optional force in-line)
283 "Make a special \"calcsum.tex\" file with just the Calc summary." 276 "Make a special \"calcsum.tex\" file with just the Calc summary."
284 (interactive "P") 277 (interactive "P")
285 (or (let ((case-fold-search t)) 278 (or (let ((case-fold-search t))
390 (insert "\\gdef\\pgref#1{\\hbox to 2em{\\indsl\\hss#1}\\ \\ }\n")) 383 (insert "\\gdef\\pgref#1{\\hbox to 2em{\\indsl\\hss#1}\\ \\ }\n"))
391 (message 384 (message
392 "Unable to find Key Index (calc.ky); no page numbers inserted")) 385 "Unable to find Key Index (calc.ky); no page numbers inserted"))
393 (switch-to-buffer buf)) 386 (switch-to-buffer buf))
394 (save-buffer)) 387 (save-buffer))
395 (message "Wrote file calcsum.tex") 388 (message "Wrote file calcsum.tex"))
396 )
397 389
398 390
399 391
400 (defun calc-public-autoloads () 392 (defun calc-public-autoloads ()
401 "Modify the public \"default\" file to contain the necessary autoload and 393 "Modify the public \"default\" file to contain the necessary autoload and
412 (setq p (cdr p))) 404 (setq p (cdr p)))
413 (or p (error "Unable to find \"default\" file. Create one and try again.")) 405 (or p (error "Unable to find \"default\" file. Create one and try again."))
414 (find-file name) 406 (find-file name)
415 (if buffer-read-only (error "No write permission for \"%s\"" buffer-file-name)) 407 (if buffer-read-only (error "No write permission for \"%s\"" buffer-file-name))
416 (goto-char (point-max)) 408 (goto-char (point-max))
417 (calc-add-autoloads home "calc-public-autoloads")) 409 (calc-add-autoloads home "calc-public-autoloads")))
418 )
419 410
420 (defun calc-private-autoloads () 411 (defun calc-private-autoloads ()
421 "Modify the user's \".emacs\" file to contain the necessary autoload and 412 "Modify the user's \".emacs\" file to contain the necessary autoload and
422 global-set-key commands for Calc." 413 global-set-key commands for Calc."
423 (interactive) 414 (interactive)
424 (let ((home default-directory)) 415 (let ((home default-directory))
425 (find-file "~/.emacs") 416 (find-file "~/.emacs")
426 (goto-char (point-max)) 417 (goto-char (point-max))
427 (calc-add-autoloads home "calc-private-autoloads")) 418 (calc-add-autoloads home "calc-private-autoloads")))
428 )
429 419
430 (defun calc-add-autoloads (home cmd) 420 (defun calc-add-autoloads (home cmd)
431 (barf-if-buffer-read-only) 421 (barf-if-buffer-read-only)
432 (let (top) 422 (let (top)
433 (if (and (re-search-backward ";;; Commands added by calc-.*-autoloads" 423 (if (and (re-search-backward ";;; Commands added by calc-.*-autoloads"
456 \(autoload 'calc-grab-rectangle \"calc\" \"Grab rectangle of data\" t) 446 \(autoload 'calc-grab-rectangle \"calc\" \"Grab rectangle of data\" t)
457 \(setq load-path (nconc load-path (list \"" (directory-file-name home) "\"))) 447 \(setq load-path (nconc load-path (list \"" (directory-file-name home) "\")))
458 \(global-set-key \"\\e#\" 'calc-dispatch) 448 \(global-set-key \"\\e#\" 'calc-dispatch)
459 ;;; End of Calc autoloads.\n") 449 ;;; End of Calc autoloads.\n")
460 (let ((trim-versions-without-asking t)) 450 (let ((trim-versions-without-asking t))
461 (save-buffer)) 451 (save-buffer)))
462 ) 452
463 453 ;;; calc-maint.el ends here
464
465
466 ;;; End.