[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why function works but *not* in *C-language mode*???

From: seberino
Subject: Why function works but *not* in *C-language mode*???
Date: Tue, 24 Sep 2002 10:45:03 -0700
User-agent: Mutt/1.4i

The following function deletes a line when I type
C-d and works great but I noticed it behaves
differently in C language mode where it deletes
one character rather than one *line*.  Why???

(global-set-key "\C-d" 'cs-kill-line)

(defun cs-kill-line(&optional arg) (interactive "P")
   (let ((current-pos (point)))
      (kill-region (line-beginning-position) 
                   (min (point-max) (+ (line-end-position arg) 1))) 
   (goto-char (min current-pos (line-end-position)))))

Here is my C language mode settings...

   (add-hook 'c-mode-hook 'turn-on-font-lock)
   (setq auto-mode-alist  '(("\\.c\\'"    . cs-c-mode)
                            ("\\.C\\'"    . cs-c-mode)
                            ("\\.cpp\\'"  . cs-c-mode)
                            ("\\.h\\'"    . cs-c-mode)
                            ("\\.java\\'" . cs-c-mode)))

(defun cs-c-mode() (interactive)
  (c-set-style "K&R")
  (setq c-basic-offset 3))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]