Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing rebox-language-character-alist #11

Open
rcoacci opened this issue Jul 25, 2014 · 4 comments
Open

Allow customizing rebox-language-character-alist #11

rcoacci opened this issue Jul 25, 2014 · 4 comments

Comments

@rcoacci
Copy link

rcoacci commented Jul 25, 2014

I'm trying to use Rebox2 for Fortran programming (yes, I know...), and since Fortran 90 uses "!" as comment char, Rebox2 doesn't work. Looking at the code it seems that allowing rebox-language-character-alist or even better use the mode's comment char (if possible) instead of hardcoding the possible chars.

@lewang
Copy link
Owner

lewang commented Jul 25, 2014

You can customize rebox-language-character-alist and call rebox-register-all-templates.

@lewang
Copy link
Owner

lewang commented Jul 25, 2014

The box detection could be made dynamic but I don't think enough people use this to make it worth the trouble.

@rrgalvan
Copy link

Hello:

I am also one of those rare persons interested in Fortran 90 and Emacs. Some time ago I customized rebox2 by adding Fortran as "language #7", specifically:

  • I added the list (7 . "!") to rebox-language-character-alist
  • I added to rebox-regexp-star the following line:
    "^[ \t]*!+" ; 7

Now rebox2 comments work in my Emacs for Fortran90. If you wish, I can send you a patch (although I think it is not difficult to include the changes by hand)

@ashiklom
Copy link

Building on the previous answer, for what it's worth, I was able to get this to work with Fortran 90 using the following use-package configuration:

(use-package rebox2
  :ensure t
  :config
  (add-to-list 'rebox-language-character-alist '(7 . "!"))
  (setq rebox-regexp-start (vconcat rebox-regexp-start '("^[ \t]*!+")))
  (rebox-register-all-templates)
  )

In theory, it should be pretty straightforward to further expand this to other comment types by just changing the ! to whatever the correct comment character is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants