emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: visiting certain .c file adds to kill ring


From: martin rudalics
Subject: Re: visiting certain .c file adds to kill ring
Date: Sat, 21 Apr 2007 12:17:10 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> With my recent cvs build or the debian snapshot, and starting from
> "emacs -Q", visiting the file foo.c below with
>
>    C-x C-f foo.c
>
> leaves the first line in the kill ring,
>
>    C-y
>    => inserts "/* hello */
>
> where I hoped it would leave the kill ring alone.  (In particular it's
> not good to have the kill changed when you're doing a cut and paste
>>from another file into that one.)
>
> I suspect c-remove-any-local-eval-or-mode-variables in cc-mode.el
> shouldn't be using kill-line, but cc-mode is hellishly complicated ...

Would the attached patch do the right thing for you?  cc-mode doesn't
like `line-beginning-position' and `line-end-position'.
*** progmodes/cc-mode.el        Mon Apr  2 07:45:14 2007
--- progmodes/cc-mode.el        Sat Apr 21 12:03:10 2007
***************
*** 820,826 ****
                      "$")
              nil t)
        (beginning-of-line)
!       (kill-line 1)))

      ;; Delete the first line, if we've got one, in case it contains a mode 
spec.
      (unless (and lv-point
--- 820,826 ----
                      "$")
              nil t)
        (beginning-of-line)
!       (delete-region (point) (progn (end-of-line) (point)))))

      ;; Delete the first line, if we've got one, in case it contains a mode 
spec.
      (unless (and lv-point
***************
*** 828,835 ****
                        (forward-line 0)
                        (bobp)))
        (goto-char (point-min))
!       (unless (eobp)
!       (kill-line 1)))))

  (defun c-postprocess-file-styles ()
    "Function that post processes relevant file local variables in CC Mode.
--- 828,834 ----
                        (forward-line 0)
                        (bobp)))
        (goto-char (point-min))
!       (delete-region (point) (progn (end-of-line) (point))))))

  (defun c-postprocess-file-styles ()
    "Function that post processes relevant file local variables in CC Mode.

reply via email to

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