all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ryan Krauss" <ryanlists@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: defining my own newline function
Date: Tue, 6 Nov 2007 08:25:02 -0600	[thread overview]
Message-ID: <c5b438120711060625l7b9235c6n3461f121cdc05243@mail.gmail.com> (raw)
In-Reply-To: <c5b438120711060556ra032216i1fcc6b87f3ca64fd@mail.gmail.com>

On 11/6/07, Ryan Krauss <ryanlists@gmail.com> wrote:
> Sorry, I meant to cc the list as well.
>
> I can't  make 'M-: (current-local-mode)' do anything.  I assume you
> want me to press Alt-Shift-: (the shift is needed to make a colon
> rather than a semi-colon?).  When I do that, I prompted with
> Eval:
>
> so, I typed
> (current-local-mode)
>
> there and I get
>
> Debugger entered--Lisp error: (void-function current-local-mode)
>  (current-local-mode)
>  eval((current-local-mode))
>  eval-expression((current-local-mode) nil)
>  call-interactively(eval-expression)
>
>
> But the info line lists my major mode as the one being run.  The
> syntax highlighting is what I have defined, and my indent function is
> being used.  My local key map is also available, with an outdent
> function bound to backtab.  These keys don't work if I create a .txt
> file where my mode isn't running.  So, I think my mode is running and
> my local key map is happening with other keys.
>
> Ryan
>
> On 11/5/07, Drew Adams <drew.adams@oracle.com> wrote:
> > > (define-key pypoutline-mode-map "\C-j" 'pypoutline-newline-and-indent)
> > > (define-key pypoutline-mode-map [<return>] 'pypoutline-newline-and-indent)
> > > (define-key py-mode-map "\C-m" 'pypoutline-newline-and-indent)
> >
> > > but none of them seem to be working.  If I type C-h k and
> > > then hit return (in a buffer running my mode), I get:
> >
> > > RET (translated from <return>) runs the command newline
> >
> > > What am I doing wrong?  Is there something I need to add
> > > to the syntax table of my mode or somewhere else?
> >
> > Are you sure that you are in your mode and that your mode has your mode map
> > as its local map? What does `M-: (current-local-mode)' tell you?
> >
> > [BTW, it's generally better to use plain text, not HTML, for email to a
> > mailing list.]
> >
> >
>


So, I found the solution to my problem.  In trying to figure out what
key combination I needed to bind in my local map, I copied and pasted
from python-mode:

(define-key py-mode-map "\C-m" 'pypoutline-newline-and-indent)

I changed the name of the function, but not the name of the map.

Apparently, "\C-m" is the right one for my settings, but I forgot to
change which mode I wanted that key mapped in.  I discovered this when
I got strange behavior while trying to edit a python file.  Changing
the last line to

(define-key pypoutline-mode-map "\C-m" 'pypoutline-newline-and-indent)

fixed my issue.

Ryan

  reply	other threads:[~2007-11-06 14:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-06  4:28 defining my own newline function Ryan Krauss
2007-11-06  5:43 ` Drew Adams
2007-11-06 13:56   ` Ryan Krauss
2007-11-06 14:25     ` Ryan Krauss [this message]
     [not found] <c5b438120711060533s4813d551s947e036870206514@mail.gmail.com>
2007-11-06 14:29 ` Drew Adams

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=c5b438120711060625l7b9235c6n3461f121cdc05243@mail.gmail.com \
    --to=ryanlists@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.