unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why function works but *not* in *C-language mode*???
@ 2002-09-24 17:45 seberino
  0 siblings, 0 replies; 5+ messages in thread
From: seberino @ 2002-09-24 17:45 UTC (permalink / raw)


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-mode)
  (c-set-style "K&R")
  (setq c-basic-offset 3))

Thanks,

Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-09-24 20:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1032889585.14887.help-gnu-emacs@gnu.org>
2002-09-24 17:58 ` Why function works but *not* in *C-language mode*??? Barry Margolin
2002-09-24 20:23   ` seberino
2002-09-24 20:09 ` Kai Großjohann
     [not found] ` <87n0q7b3po.fsf@blarg.net>
2002-09-24 20:22   ` seberino
2002-09-24 17:45 seberino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).