I'm currently learning both emacs and webdev. I'm trying to not go too far down the emacs configuration and customization rabbit hole out of the gate so that I can actually progress on the odin project. But its too intriguing to not build out some automation and QoL implementations.
A recent fix I implemented showed me the power of being able to quickly customize built in or added package functionality to be what I want it to be. But it raised the question on best practices for doing such things.
The example in question was navigating tags with web-mode and emmet-mode both enabled. There is some built in navigation for elements but I found one bit confusing/inefficent.
ex:
I use ul>li\*5 to make a list with 5 items in it. It smartly jumps between the first <li></li>. I enter some text and use "C-c C-e n" to move to the next element. But its at the start of the next element i.e. before the < in <li>. So I wrote a very quick and dirty macro in lisp and bound it to "C-x t". You can see that very crude and terrible implementation below.
My core question here is whether such an implementation is better as a macro that calls the web-mode-element-next command and makes adjustments from there or is it better to just go in and make changes to web-mode-element-next and call it normally. Granted I'll utimately make a better solution that moves the point to the end of tag after > probably finding the character with regex or something. I just don't know lisp well enough yet.
​
**My next-tag function - very crude just showing a code structure sample.**
(defun next-tag()
(interactive)
(web-mode-element-next)
(forward-char)
(forward-char)
(forward-char)
(forward-char))
(global-set-key (kbd "C-x t") 'next-tag)