all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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
[parent not found: <mailman.1032889585.14887.help-gnu-emacs@gnu.org>]

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 --
2002-09-24 17:45 Why function works but *not* in *C-language mode*??? seberino
     [not found] <mailman.1032889585.14887.help-gnu-emacs@gnu.org>
2002-09-24 17:58 ` 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.