Loading ...
Sorry, an error occurred while loading the content.

Uses nxhtml-mode in an no-standard extension files

Expand Messages
  • ygneo01
    Hi everybody! I m beginning to use nxhtml-mode and I m a beginner in emacs too. I d to know how I can use the mode in files with an arbitray extension (such as
    Message 1 of 11 , Mar 28, 2008
    • 0 Attachment
      Hi everybody!

      I'm beginning to use nxhtml-mode and I'm a beginner in emacs too.

      I'd to know how I can use the mode in files with an arbitray extension
      (such as .ctp, i.e)

      Greetings and thanks a lot!
    • Niels Giesen
      ... one-off: M-x nxhtml-mode automatically n always: add (add-to-list auto-mode-alist ( .ctp . nxhtml-mode)) to your .emacs For this to take effect
      Message 2 of 11 , Mar 28, 2008
      • 0 Attachment
        "ygneo01" <ygneo01@...> writes:

        > Hi everybody!
        >
        > I'm beginning to use nxhtml-mode and I'm a beginner in emacs too.
        >
        > I'd to know how I can use the mode in files with an arbitray extension
        > (such as .ctp, i.e)

        one-off: M-x nxhtml-mode

        automatically 'n' always: add

        (add-to-list 'auto-mode-alist
        '("\\.ctp\\'" . nxhtml-mode))

        to your .emacs

        For this to take effect immediately (in the same session) type C-x C-e
        with your cursor right after the expression.


        >
        > Greetings and thanks a lot!
        >
        >
        >

        --
        http://niels.kicks-ass.org
      • Lennart Borgman (gmail)
        ... That would work. If you want multiple major modes then you should instead use something like ( .ctp . nxhtml-mumamo)
        Message 3 of 11 , Mar 28, 2008
        • 0 Attachment
          Niels Giesen wrote:
          > (add-to-list 'auto-mode-alist
          > '("\\.ctp\\'" . nxhtml-mode))
          >
          > to your .emacs


          That would work. If you want multiple major modes then you should
          instead use something like

          '("\\.ctp\\'" . nxhtml-mumamo)
        • ygneo01
          ... Thanks a lot, but it doesn t works for me. I ve this error: File mode specification error: (void-function nxhtml-mumamo) Any idea?
          Message 4 of 11 , Mar 31, 2008
          • 0 Attachment
            --- In emacs-nxml-mode@yahoogroups.com, "Lennart Borgman (gmail)"
            <lennart.borgman@...> wrote:
            >
            > Niels Giesen wrote:
            > > (add-to-list 'auto-mode-alist
            > > '("\\.ctp\\'" . nxhtml-mode))
            > >
            > > to your .emacs
            >
            >
            > That would work. If you want multiple major modes then you should
            > instead use something like
            >
            > '("\\.ctp\\'" . nxhtml-mumamo)
            >

            Thanks a lot, but it doesn't works for me. I've this error:

            File mode specification error: (void-function nxhtml-mumamo)

            Any idea?
          • Reinout van Rees
            ... Alt-x nxml-mode should give you the nxml mode for the current file that you re visiting. To do it automatically, put something like the following in your
            Message 5 of 11 , Mar 31, 2008
            • 0 Attachment
              On Fri, Mar 28, 2008 at 11:32 AM, ygneo01 <ygneo01@...> wrote:
              >
              > I'm beginning to use nxhtml-mode and I'm a beginner in emacs too.
              >
              > I'd to know how I can use the mode in files with an arbitray extension
              > (such as .ctp, i.e)

              "Alt-x nxml-mode" should give you the nxml mode for the current file
              that you're visiting.

              To do it automatically, put something like the following in your .emacs

              (autoload 'nxml-mode "nxml-mode" "XML editing mode." t)
              ;(load "rng-auto.el")
              (setq auto-mode-alist
              (cons '("\\.\\(xml\\|html\\|htm\\|xslt\\|pt\\|cpt\\|zcml\\|xsl\\)\\'"
              . nxml-mode)
              auto-mode-alist))


              Reinout

              --
              Reinout van Rees (reinout@...)
              Work: http://zestsoftware.nl/ Blog: http://vanrees.org/weblog/
              "I can be googled, therefore I am."
            • Florent Georges
              Reinout van Rees wrote: Hi ... push is available for a while now in GNU Emacs, so for the sake of readibility I suggest the equivalent (but that s just
              Message 6 of 11 , Mar 31, 2008
              • 0 Attachment
                Reinout van Rees wrote:

                Hi

                > (autoload 'nxml-mode "nxml-mode" "XML editing mode." t)
                > ;(load "rng-auto.el")
                > (setq auto-mode-alist
                > (cons
                > '("\\.\\(xml\\|html\\|htm\\|xslt\\|pt\\|cpt\\|zcml\\|xsl\\)\\'"
                > . nxml-mode)
                > auto-mode-alist))

                push is available for a while now in GNU Emacs, so for the sake of
                readibility I suggest the equivalent (but that's just cosmetic):

                (push '("\\...\\'" . nxml-mode) auto-mode-alist)

                More importantly, don't forget magic-mode-alist:

                (push '("\\`<\\?xml" . nxml-mode) magic-mode-alist)

                That will use nXML for all files whose the content starts with "<?xml"
                (that is, the beginning of an XML declaration.) That have precedence
                over auto-mode-alist.

                And of course, because he seems to be installing nXML, the OP will be
                perhaps interested by schema locating files to install additional
                format understood by nXML (for validation, completion...) See (info
                "(nxml-mode)Schema locating files").

                Regards,

                --drkm























                _____________________________________________________________________________
                Envoyez avec Yahoo! Mail. Plus de moyens pour rester en contact. http://mail.yahoo.fr
              • Lennart Borgman (gmail)
                ... Yes. You are using an old version of nXhtm ;-) Please grab the latest version and try again.
                Message 7 of 11 , Mar 31, 2008
                • 0 Attachment
                  ygneo01 wrote:
                  >
                  >
                  > --- In emacs-nxml-mode@yahoogroups.com
                  > <mailto:emacs-nxml-mode%40yahoogroups.com>, "Lennart Borgman (gmail)"
                  > <lennart.borgman@...> wrote:
                  > >
                  > > Niels Giesen wrote:
                  > > > (add-to-list 'auto-mode-alist
                  > > > '("\\.ctp\\'" . nxhtml-mode))
                  > > >
                  > > > to your .emacs
                  > >
                  > >
                  > > That would work. If you want multiple major modes then you should
                  > > instead use something like
                  > >
                  > > '("\\.ctp\\'" . nxhtml-mumamo)
                  > >
                  >
                  > Thanks a lot, but it doesn't works for me. I've this error:
                  >
                  > File mode specification error: (void-function nxhtml-mumamo)
                  >
                  > Any idea?

                  Yes. You are using an old version of nXhtm ;-)

                  Please grab the latest version and try again.
                • Jason Rumney
                  ... I d suggest using add-to-list rather than push for the following reasons: 1.It avoids duplicate entries. 2. It is part of elisp so doesn t pull in the full
                  Message 8 of 11 , Mar 31, 2008
                  • 0 Attachment
                    Florent Georges wrote:
                    >
                    > push is available for a while now in GNU Emacs, so for the sake of
                    > readibility I suggest the equivalent (but that's just cosmetic):
                    >
                    > (push '("\\...\\'" . nxml-mode) auto-mode-alist)
                    >

                    I'd suggest using add-to-list rather than push for the following reasons:

                    1.It avoids duplicate entries.
                    2. It is part of elisp so doesn't pull in the full common lisp
                    compatibility library.
                  • Jason Rumney
                    ... Ignore this. `push is part of elisp, but cl.el redefines it, which is why I thought it would pull in all of common lisp with it.
                    Message 9 of 11 , Mar 31, 2008
                    • 0 Attachment
                      Jason Rumney wrote:
                      > 2. It is part of elisp so doesn't pull in the full common lisp
                      > compatibility library.
                      >

                      Ignore this. `push' is part of elisp, but cl.el redefines it, which is
                      why I thought it would pull in all of common lisp with it.
                    • Florent Georges
                      ... Actually push was not defined by Emacs before, but only in cl. That was a good enough reason to not use it (well, that depends on people, I like cl.)
                      Message 10 of 11 , Mar 31, 2008
                      • 0 Attachment
                        Jason Rumney wrote:

                        > Jason Rumney wrote:

                        > > 2. It is part of elisp so doesn't pull in the full common lisp
                        > > compatibility library.

                        > Ignore this. `push' is part of elisp, but cl.el redefines it,
                        > which is why I thought it would pull in all of common lisp with
                        > it.

                        Actually push was not defined by Emacs before, but only in cl. That
                        was a good enough reason to not use it (well, that depends on people, I
                        like cl.)

                        Regards,

                        --drkm




















                        _____________________________________________________________________________
                        Envoyez avec Yahoo! Mail. Plus de moyens pour rester en contact. http://mail.yahoo.fr
                      • Florent Georges
                        ... That s right, I forgot that point. And that s actually the main point why I prefer push. Of course that depends on the use, but most of the time you
                        Message 11 of 11 , Mar 31, 2008
                        • 0 Attachment
                          Jason Rumney wrote:

                          > I'd suggest using add-to-list rather than push for the following
                          > reasons:

                          > 1.It avoids duplicate entries.

                          That's right, I forgot that point. And that's actually the main
                          point why I prefer push. Of course that depends on the use, but most
                          of the time you really want push instead of add-to-list (.emacs.el is a
                          good example I think.)

                          > 2. It is part of elisp so doesn't pull in the full common lisp
                          > compatibility library.

                          See other email.

                          Regards,

                          --drkm






















                          _____________________________________________________________________________
                          Envoyez avec Yahoo! Mail. Plus de moyens pour rester en contact. http://mail.yahoo.fr
                        Your message has been successfully submitted and would be delivered to recipients shortly.