Closed balaji-dutt closed 4 years ago
Hi @balaji-dutt . Thank you for comment. Please write in detail your OS, your spacemacs settings, etc at first.
Hi @balaji-dutt . Please write in detail your OS, your spacemacs settings, etc at first.
Sure. Sorry about that - have updated the original issue with those details.
Please write in detail also easy-hugo setting.
Please write in detail also easy-hugo setting.
Updated - sorry, I promise I'm usually better at filing GitHub issues than this 😞
If you use easy-hugo with Spacemacs, you need to assign it to n with easy-hugo-mode-map. See https://github.com/cescoferraro/dotfiles/blob/master/src/emacs.d/configuration.org#hugo .
Hi @masasam I actually did have the easy-hugo-mode-map
configured since you reference it in the README. I realize there was a potential function name collision, so I made the following changes - extract from my config:
;; Configure easy-hugo
(with-eval-after-load 'easy-hugo
(setq easy-hugo-basedir "f:/Balaji/Development/notebook/"
easy-hugo-server-flags "-D"
easy-hugo-postdir "content/posts"
easy-hugo-image-directory "static/img"
easy-hugo-url "https://nb.balaji.blog"
easy-hugo-preview-url "http://127.0.0.1:1313/"
)
(add-hook 'easy-hugo-mode-hook 'my-private-layer/easy-hugo-config)
)
Function definition for my-private-layer/easy-hugo-config
(defun my-private-layer/easy-hugo-config ()
(interactive)
(evil-define-key
(list 'normal 'insert 'visual 'motion)
easy-hugo-mode-map
"n" 'easy-hugo-newpost
"D" 'easy-hugo-article
"p" 'easy-hugo-preview
"P" 'easy-hugo-publish
"o" 'easy-hugo-open
"d" 'easy-hugo-delete
"e" 'easy-hugo-open
"c" 'easy-hugo-open-config
"f" 'easy-hugo-open
"N" 'easy-hugo-no-help
"v" 'easy-hugo-view
"r" 'easy-hugo-refresh
"g" 'easy-hugo-refresh
"s" 'easy-hugo-sort-time
"S" 'easy-hugo-sort-char
"G" 'easy-hugo-github-deploy
"A" 'easy-hugo-amazon-s3-deploy
"C" 'easy-hugo-google-cloud-storage-deploy
"q" 'evil-delete-buffer
(kbd "TAB") 'easy-hugo-open
(kbd "RET") 'easy-hugo-preview)
(define-key global-map (kbd "C-c C-e") 'easy/hugo))
However even after the above changes, I still get the same error message when selecting n
in easy-hugo
mode.
I think with-eval-after-load is not good. Try without with-eval-after-load.
I think with-eval-after-load is not good. Try without with-eval-after-load.
I thought the recommended practice is to use with-eval-after-load
since this prevents errors when package cannot be found?
In any case I made some changes, but still seeing the same error message 😞
(defun my-private-layer/init-easy-hugo ()
"Initialization of easy-hugo"
(use-package easy-hugo
:ensure t
:config
(setq easy-hugo-basedir "f:/Balaji/Development/notebook/"
easy-hugo-server-flags "-D"
easy-hugo-postdir "content/posts"
easy-hugo-image-directory "static/img"
easy-hugo-url "https://nb.balaji.blog"
easy-hugo-preview-url "http://127.0.0.1:1313/"
)
(add-hook 'easy-hugo-mode-hook 'my-private-layer/easy-hugo-config)
(lambda ()
(setq flyspell-mode 1))
)
)
Try :init instead of :config.
Try :init instead of :config.
Can I just say thank you so much for the quick responses! 👍
But sadly changing to :init
does not seem to help.
Try the following.
(defun my-private-layer/easy-hugo-config () (interactive) (evil-define-key (list 'normal 'insert 'visual 'motion) easy-hugo-mode-map "n" 'easy-hugo-newpost "D" 'easy-hugo-article "p" 'easy-hugo-preview "P" 'easy-hugo-publish "o" 'easy-hugo-open "d" 'easy-hugo-delete "e" 'easy-hugo-open "c" 'easy-hugo-open-config "f" 'easy-hugo-open "N" 'easy-hugo-no-help "v" 'easy-hugo-view "r" 'easy-hugo-refresh "g" 'easy-hugo-refresh "s" 'easy-hugo-sort-time "S" 'easy-hugo-sort-char "G" 'easy-hugo-github-deploy "A" 'easy-hugo-amazon-s3-deploy "C" 'easy-hugo-google-cloud-storage-deploy "q" 'evil-delete-buffer (kbd "TAB") 'easy-hugo-open (kbd "RET") 'easy-hugo-preview) (define-key global-map (kbd "C-c C-e") 'easy/hugo))
(use-package easy-hugo :ensure t :config ←or :init (setq easy-hugo-basedir "f:/Balaji/Development/notebook/" easy-hugo-server-flags "-D" easy-hugo-postdir "content/posts" easy-hugo-image-directory "static/img" easy-hugo-url "https://nb.balaji.blog" easy-hugo-preview-url "http://127.0.0.1:1313/" ) ) (add-hook 'easy-hugo-mode-hook 'my-private-layer/easy-hugo-config)
Hi @masasam I'm not sure if you specifically meant to remove the (defun my-private-layer/init-easy-hugo () )
part. However, if I remove that part, Spacemacs breaks on loading so I had to put it back.
No change in the error message after changing the sequence.
I think this is a problem with evil-define-key not working in your enviroment. I can't reproduce this issue because I don't use spacemacs, use-package and windows.
Hm I see. I have been able to use evil-define-key in other parts of my init.el
so I'm not sure what's the issue. This is not a major loss since w
still works, it's just that the n
is the default in easy-hugo-help and I'm still learning easy-hugo so can't disable that altogether.
Have you try https://github.com/humanfactors/spacemacs-easy-hugo ?
@masasam Thanks for pointing me to that package. Rather that installing the layer directly, I realized he was using a different function to set the keys namely spacemacs/set-leader-keys-for-major-mode
so I used that in my config as well.
I would still get an error if I directly invoked n
in easy-hugo mode but typing SPC m n
(which is what set-leader-keys does) works fine. You might want to point other Spacemacs users to this layer rather than the current link in the README.
@balaji-dutt I've added spacemacs-easy-hugo to the README. Thanks for your cooperation.
Hello,
I'm relatively new to Emacs, so my knowledge on these types of issues is relatively limited. So I apologize if this is not really an easy-hugo issue at all.
I'm currently using the Spacemacs distribution of emacs and have installed
easy-hugo
as an additional package. When I launcheasy-hugo
mode and typen
for a new blog-post, I get the following error:However, I have not been able to trace this issue further due to a few problems:
I've tried debugging
easy-hugo-newpost
by selecting the function inM-x debug-on-entry
. However, the error occurs even before the function is called.Using
w
as the shortcut for hugo-newpost works fine and does not generate the same error.The above error occurs irrespective of me using Emacs mode or Evil mode in Spacemacs.
Does anyone have any suggestions on how I can trace this issue further?
easy-hugo config
System Info