Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Problem with emacs mode

 [1/5] from: chris::starforge::co::uk at: 28-Apr-2001 11:20


Hi, After Code Crusader died when I upgraded to Mandrake 8, I had to go back to Emacs for editing. I downloaded the latest version of the rebol.el file, set it up to activate using (setq load-path (cons "~/rebol" load-path)) (load-library "rebol") (add-to-list 'auto-mode-alist '("\\.r\\'" . rebol-mode) (add-to-list 'auto-mode-alist '("\\.cgi\\'" . rebol-mode) which seems to work fine. The mode itself becomes a little confused if speechmarks are used as part of html generation - if I have one speechmark in a data file, and another in the script it becomes confused about what is a string and what isn't. And I guess that's the cause of the problem I'm having: the indent doesn't work properly. In one place in my code I'm closing an if block - it should be indented 8 characters from the left, but rebol.el wants to put it out at 60 characters! I find auto-indent annoying enough in any mode, but this makes an otherwise great mode almost unusable. How can I completely deactivate the indent in emacs? I've never been able to find out how :( Chris -- New sig in the works Explorer 2260, Designer and Coder http://www.starforge.co.uk -- You can't judge a book by the way it wears its hair.

 [2/5] from: chris:starforge at: 28-Apr-2001 13:26


#28-Apr-01# Message from *Chris*: Hi Chris,
> I find auto-indent annoying enough in any mode, but this makes an > otherwise great mode almost unusable. How can I completely deactivate the > indent in emacs? I've never been able to find out how :(
They say that replying to your own mails is a sure sign of insanity (in which case I'm ahead of the game..) but some protracted work with google had finally turned up the answer for me. Just incase anyone else suffers at the hands of syntax based indentation all you need to do is add (local-set-key (kbd "TAB") 'indent-relative) to the hook for the modes you use, for example: (add-hook 'rebol-mode-hook '((local-set-key (kbd "TAB") 'indent-relative)) Chris -- New sig in the works Explorer 2260, Designer and Coder http://www.starforge.co.uk -- Why do you sit there looking like an envelope without any address on it? -- Mark Twain

 [3/5] from: d4marcus:dtek:chalmers:se at: 28-Apr-2001 20:36


On Sat, 28 Apr 2001, Chris wrote:
> After Code Crusader died when I upgraded to Mandrake 8, I had to go back > to Emacs for editing. I downloaded the latest version of the rebol.el file, > which seems to work fine. The mode itself becomes a little confused if > speechmarks are used as part of html generation - if I have one speechmark > in a data file, and another in the script it becomes confused about what is > a string and what isn't.
I don't quite follow. What is a speechmark?
> And I guess that's the cause of the problem I'm having: the indent doesn't > work properly. In one place in my code I'm closing an if block - it should > be indented 8 characters from the left, but rebol.el wants to put it out at > 60 characters!
You got to show me an example of this. The indentation is all redone, which means there could be a couple of bugs in it (so far I have found one myself). Nevertheless, 5 times wrong seem a little too much.
> I find auto-indent annoying enough in any mode, but this makes an otherwise > great mode almost unusable. How can I completely deactivate the indent in > emacs? I've never been able to find out how :(
I didn't find any function or variable called auto-indent in Emacs. If you are referring to the automatic indentation when you press return, the README tells you how to turn it off. Marcus ------------------------------------ If you find that life spits on you calm down and pretend it's raining

 [4/5] from: chris:starforge at: 28-Apr-2001 20:06


#28-Apr-01# Message from *Marcus Petersson*: Hi Marcus,
>> it should be indented 8 characters from the left, but rebol.el wants to >> put it out at 60 characters! > You got to show me an example of this.
I'll send you a copy of the code off list. I doubt the list would appreciate a 38k attachment...
>> I find auto-indent annoying enough in any mode, but this makes an >> otherwise great mode almost unusable. How can I completely deactivate the >> indent in emacs? I've never been able to find out how :( > I didn't find any function or variable called auto-indent in Emacs. If you > are referring to the automatic indentation when you press return, the > README tells you how to turn it off.
It's the syntax based indentation. When I pressed tab (not return) it produced the indent I described above. Chris -- New sig in the works Explorer 2260, Designer and Coder http://www.starforge.co.uk -- Go 'way! You're bothering me!

 [5/5] from: d4marcus:dtek:chalmers:se at: 29-Apr-2001 22:30


CC'ing to the list here, as this could concern more people. On Sat, 28 Apr 2001, Chris wrote:
> I have attached a copy of the source that caused the problems I described. > Try going to line 405 and pressing the tab key, that should reproduce the 60 > space indent.
Yes I see. It's the semicolon in the braced string that gets interpreted as a comment-starter. You see, the problem with Emacs is that even though the braced string can be fontified as a "string", it isn't syntactically recognized as a string. There's no way I can help this, or so it seems when I read the elisp doc. In other words, Emacs doesn't allow for a balanced string expression (i.e. with a start and end string char"). The cause is not lost however. There may be ways to make the syntax table for comments, or perhaps the comment-start variable, smarter. This will take quite some time to investigate though. My recommended solution is instead that you escape all semicolons within braced strings with a caret, as in { ... nbsp^; ...}. I don't think this will affect the Rebol program in any way, but will allow indentation to work properly. To the list: If someone has a better idea, please let me know. Marcus ------------------------------------ If you find that life spits on you calm down and pretend it's raining