all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: seberino@spawar.navy.mil
Subject: Why function works but *not* in *C-language mode*???
Date: Tue, 24 Sep 2002 10:45:03 -0700	[thread overview]
Message-ID: <20020924174503.GA16405@spawar.navy.mil> (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

             reply	other threads:[~2002-09-24 17:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-24 17:45 seberino [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020924174503.GA16405@spawar.navy.mil \
    --to=seberino@spawar.navy.mil \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.