Page 3 of 3 FirstFirst 123
Results 21 to 22 of 22

Thread: Make emacs recognize 'end' keyword in Octave-mode

  1. #21
    Join Date
    Oct 2009
    Location
    New Jersey, USA
    Beans
    246
    Distro
    Ubuntu Development Release

    Re: Make emacs recognize 'end' keyword in Octave-mode

    Quote Originally Posted by jpkotta View Post
    Do you have everything in the eval-after-load? eval-after-load will only eval things after the specified .el file is loaded, thus there should be no undefined variables.

    If you are editing octave-mod.el, make sure there is no corresponding .elc file, as that will be preferred. You can either recompile octave-mod.el or put octave-mod.el in a directory nearer to the beginning of load-path.
    This is precisely what I was made to understand in the last few hours - I filed a bug report with emacs (octave-mod.el is no longer part of octave and has been moved to emacs I was told) and I was informed that the latest version of emacs has the octave-mod.el file completely rewritten, using a module smie.el that is not there in the current 23.2 version. So I pulled the latest version of emacs from the trunk in bazaar, and checkinstalled it. During the "make bootstrap" stage I came to realize that all the ".el" files were being compiled into ".elc" files, which is why merely changing the octave-mod.el file did not work at all. In this new version of emacs, the "end" keyword works just fine. There is another issue however - that there appears to be no "block-match-alist" in this version and emacs does not warn if a wrong end keyword is put in, say, "endif" with "for". I have stated this in the follow-up of the bug report. I guess I will mark the thread as "solved" for the time being - thanks a lot for your hekp all the way though - I would not have been pointed to octave-mod.el otherwise!
    Be formless, shapeless... like water. Now you put water into a cup, it becomes the cup; you put water into a bottle it becomes the bottle; if you put it in a teapot it becomes the teapot... Now water can flow, or it can crash... Be water my friend

  2. #22
    Join Date
    Oct 2008
    Beans
    1

    Talking Re: Make emacs recognize 'end' keyword in Octave-mode

    Quote Originally Posted by manzdagratiano View Post
    This is precisely what I was made to understand in the last few hours - I filed a bug report with emacs (octave-mod.el is no longer part of octave and has been moved to emacs I was told) and I was informed that the latest version of emacs has the octave-mod.el file completely rewritten, using a module smie.el that is not there in the current 23.2 version. So I pulled the latest version of emacs from the trunk in bazaar, and checkinstalled it. During the "make bootstrap" stage I came to realize that all the ".el" files were being compiled into ".elc" files, which is why merely changing the octave-mod.el file did not work at all. In this new version of emacs, the "end" keyword works just fine. There is another issue however - that there appears to be no "block-match-alist" in this version and emacs does not warn if a wrong end keyword is put in, say, "endif" with "for". I have stated this in the follow-up of the bug report. I guess I will mark the thread as "solved" for the time being - thanks a lot for your hekp all the way though - I would not have been pointed to octave-mod.el otherwise!
    This thread solves my problem neatly! Good work!
    By the way, I don't know how you solve the variable undefined problem.
    Here is my way.I add that piece of code in the add-hook function for the octave-mode. And it works fine. Hope this will help.
    Code:
    (add-hook 'octave-mode-hook
              (lambda ()
                (eval-after-load "octave-mod"
                  (progn
                    (add-to-list 'octave-end-keywords "end[[:space:]]*\\([%#].*\\|$\\)")
    		(setq octave-block-end-regexp
                          (concat "\\<\\("
                                  (mapconcat 'identity octave-end-keywords "\\|")
                                  "\\)\\>"))
    		))
                (abbrev-mode 1)
                (auto-fill-mode 1))

Page 3 of 3 FirstFirst 123

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •