1 ;;; tu-comment.el --- a comment out utility for Lisp programs.
3 ;; Copyright (C) 1995,1996 MORIOKA Tomohiko
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Version: $Id: tu-comment.el,v 1.1.1.1 1998-01-14 06:27:57 steve Exp $
8 ;; Keywords: comment, Lisp
10 ;; This file is part of tl (Tiny Library).
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or (at
15 ;; your option) any later version.
17 ;; This program is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with this program; see the file COPYING. If not, write to
24 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
30 ;; 1. bytecompile this file and copy it to the apropriate directory.
31 ;; 2. put the following lines to your ~/.emacs:
32 ;; (autoload 'comment-sexp "tu-comment" nil t)
33 ;; (global-set-key "\C-c\C-q" 'comment-sexp)
35 ;; type `C-c C-q' at the beginning of S-expression you want to
40 (defvar comment-sexp-first-line-method-alist
41 '((emacs-lisp-mode . comment-sexp-middle-line-method-for-lisp)
42 (lisp-interaction-mode . comment-sexp-middle-line-method-for-lisp)
43 (lisp-mode . comment-sexp-middle-line-method-for-lisp)
44 (scheme-mode . comment-sexp-middle-line-method-for-lisp)
45 (c-mode . comment-sexp-first-line-method-for-c)
46 (c++-mode . comment-sexp-middle-line-method-for-c++)
49 (defvar comment-sexp-middle-line-method-alist
50 '((emacs-lisp-mode . comment-sexp-middle-line-method-for-lisp)
51 (lisp-interaction-mode . comment-sexp-middle-line-method-for-lisp)
52 (lisp-mode . comment-sexp-middle-line-method-for-lisp)
53 (scheme-mode . comment-sexp-middle-line-method-for-lisp)
54 (c-mode . comment-sexp-middle-line-method-for-c)
55 (c++-mode . comment-sexp-middle-line-method-for-c++)
58 (defvar comment-sexp-last-line-method-alist
59 '((emacs-lisp-mode . comment-sexp-last-line-method-for-dummy)
60 (lisp-interaction-mode . comment-sexp-last-line-method-for-dummy)
61 (lisp-mode . comment-sexp-last-line-method-for-dummy)
62 (scheme-mode . comment-sexp-last-line-method-for-dummy)
63 (c-mode . comment-sexp-last-line-method-for-c)
64 (c++-mode . comment-sexp-last-line-method-for-dummy)
67 (defun comment-sexp-middle-line-method-for-lisp ()
71 (defun comment-sexp-middle-line-method-for-c++ ()
75 (defun comment-sexp-first-line-method-for-c ()
79 (defun comment-sexp-middle-line-method-for-c ()
83 (defun comment-sexp-last-line-method-for-c (c)
92 (defun comment-sexp-last-line-method-for-dummy (c))
94 (defun comment-sexp ()
96 (let ((c (current-column))
107 (narrow-to-region b e)
113 (cdr (assq major-mode comment-sexp-first-line-method-alist)))
116 (while (< (point) (point-max))
120 (cdr (assq major-mode comment-sexp-middle-line-method-alist)))
125 (cdr (assq major-mode comment-sexp-last-line-method-alist)) c)
128 ;;; tu-comment.el ends here