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
Trying to add support for elisp under restclient-mode #213
Comments
You need to use [Deleted wrong code] |
Arh, sorry. I got confused. You don't need the auto-innermode. Those are only for cases when you don't know the mode in advance. This will do: [deleted obsoleted code] |
@vspinu Thank you so much, works great. There's one issue with hl-line, but I'll check he issue list and file a bug if that's not in the list already. This is really cool stuff you've built! |
Actually it occurred to me that you would like to have the head of the chunk in I have changed the naming conventions and added new sugar macros to define innermodes. So the canonical way to define this mode would now be: (define-hostmode poly-restclient-hostmode
:mode 'restclient-mode)
(define-innermode poly-restclient-elisp-root-innermode
:mode 'emacs-lisp-mode
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-restclient-elisp-single-innermode poly-restclient-elisp-root-innermode
:head-matcher "^:[^ ]+ :="
:tail-matcher "\n")
(define-innermode poly-restclient-elisp-multi-innermode poly-restclient-elisp-root-innermode
:head-matcher "^:[^ ]+ := <<"
:tail-matcher "^#$")
(define-polymode poly-restclient-mode
:hostmode 'poly-restclient-hostmode
:innermodes '(poly-restclient-elisp-single-innermode
poly-restclient-elisp-multi-innermode)) |
@vspinu Ah, thanks! Updated the package now and applied the configuration changes. hl-line still gets stuck though, possibly less, but is cleared when entering next section. But maybe your changes only fixed so that poly-mode is applied to the full section (a problem I hadn't noticed before). Sample with some comments trying to describe what happens:
The benefits of having poly-mode greatly outweighs the minor annoyance with the hl-line issue, so thanks again! |
Is this the same as with #100? As far as I know hl-line should be treated fine. Would you mind opening a new issue with a screenshot? |
I cannot reproduce the hl-line problem with your example but I see some font-lock issues when highlighting headers though. The highlighting is changing as you type in the host mode. Do you see that? |
Ok, I got this. It's fixed now. Still no sign of your hl-line problem on my side. |
I've put together a minimal-isch init.el that reproduces the problem. I've verified it both in latest emacs from git on macOS, as well as 26.1 under Linux. init.el: (require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/")
'("gnu" . "http://elpa.gnu.org/packages/"))
(package-initialize)
(custom-set-variables
'(custom-file "~/.emacs.d/custom.el"))
(condition-case err
(require 'use-package)
(error (progn
(package-refresh-contents)
(package-install 'use-package)
(require 'use-package))))
(custom-set-variables
'(use-package-always-ensure t)
'(use-package-compute-statistics t))
(use-package hl-line
:config
(global-hl-line-mode))
(use-package polymode
:init
(define-hostmode poly-restclient-hostmode
:mode 'restclient-mode)
(define-innermode poly-restclient-elisp-root-innermode
:mode 'emacs-lisp-mode
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-restclient-elisp-single-innermode poly-restclient-elisp-root-innermode
:head-matcher "^:[^ ]+ :="
:tail-matcher "\n")
(define-innermode poly-restclient-elisp-multi-innermode poly-restclient-elisp-root-innermode
:head-matcher "^:[^ ]+ := <<"
:tail-matcher "^#$")
(define-polymode poly-restclient-mode
:hostmode 'poly-restclient-hostmode
:innermodes '(poly-restclient-elisp-single-innermode
poly-restclient-elisp-multi-innermode)))
(use-package restclient
:commands
(restclient-mode)
:hook
(restclient-mode . poly-restclient-mode)
:custom
(restclient-same-buffer-response t)) |
Arh, I see. It's because of the global mode. It's activated in all buffers, base and indirect alike, so you get multiple lines. I was always testing with |
Fixed in master. |
New to this package, seems very cool! But I'm having problems adding support for marking elisp under restclient-mode to be handled by polymode.
It has the following ways of declaring variables via emacs-lisp:
Single line:
Multi line:
My polymode declarations are as follows:
When I open a file and
M-x restclient-mode
nothing happens. If IM-x
polymode-minor-mode
, nothing happens, and if IM-x poly-restclient-mode
I think I getemacs-lisp-code
for the whole file.The text was updated successfully, but these errors were encountered: