help-gnu-emacs
[Top][All Lists]
Advanced

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

C-M-a


From: Michael D. Vose
Subject: C-M-a
Date: Fri, 25 Jan 2008 16:13:58 -0500

Before upgrading to GNU Emacs 22.1.1 (sorry I don't know what my old
version was), C-M-a would behave in c-mode like it did and currently
does in fundamental mode... specifically: if the cursor was below the
closing brace of the body of main (see code below), then C-M-a would
move the position of the cursor to the opening brace of the body of
main

int main(int argc, char *argv[])
{
  short a,b,bit,i;  short mask = 0x80;

  a = atoi(argv[1]); 
  b = atoi(argv[2]);

  printf("a = %d, b = %d, a|b = %d, a&b = %d\n",a,b,a|b,a&b);

  return 0;
}

However now (in c-mode using GNU Emacs 22.1.1) C-M-a positions the
cursor at the beginning of "int main(int argc, char *argv[])".  I have
tried to change this new behavior back to the old behavior described
above -- I WANT THE CURSOR AT THE OPENING BRACE just where C-M-a puts
it in fundamental mode -- by putting the following into my .emacs file

(add-hook 'c-mode-hook
               '(lambda ()
                  (defvar beginning-of-defun-function nil)
                  (defvar defun-prompt-regexp         nil)
                  (local-set-key  [?\M-\C-a] 'beginning-of-defun)))

Unfortunately, that does not work.  What motivated the above attempt
at restoring desired behavior was the fact when in fundamental mode
M-x find-function-on-key reports that C-M-a invokes beginning-of-defun.

What can I do to make C-M-a behave in c-mode like it does in
fundamental mode?

Thanks.




reply via email to

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