emacs-vs / auto-rename-tag Goto Github PK
View Code? Open in Web Editor NEWAutomatically rename paired HTML/XML tag.
License: GNU General Public License v3.0
Automatically rename paired HTML/XML tag.
License: GNU General Public License v3.0
Hi there, awesome package. I really like the similar VS Code package whenever I find myself using VS Code.
Unfortunately for me, this mode appears to add significant latency to every change command. To make matters worse, there seems to be something it does that angers tide-mode and causes tide-mode to continually run tide-net-filter
which in turn triggers the auto-rename-tag-before-change-functions
. The end result is that when I make a change to a tag with tide-mode
enabled, Emacs more or less becomes unusable.
Here's an example profile:
- tide-net-filter 8816 51%
- auto-rename-tag-before-change-functions 8597 49%
- auto-rename-tag-inside-tag 8597 49%
- auto-rename-tag-backward-char-at-point 8597 49%
- auto-rename-tag-backward-goto-char 7558 43%
auto-rename-tag-current-char-equal-p 6370 36%
- tide-decode-response 218 1%
- auto-rename-tag-before-change-functions 194 1%
- auto-rename-tag-inside-tag 194 1%
- auto-rename-tag-backward-char-at-point 193 1%
- auto-rename-tag-backward-goto-char 192 1%
auto-rename-tag-current-char-equal-p 184 1%
auto-rename-tag-forward-char-at-point 1 0%
- tide-dispatch 18 0%
+ tide-dispatch-response 18 0%
+ tide-decode-response 3 0%
tide-decode-response-legth 2 0%
+ json-read-object 1 0%
With tide mode disabled, it's usable, but still chugs as I make changes with a more confusing profile:
- redisplay_internal (C function) 994 77%
- #<compiled 0x41a11657> 991 76%
- window--adjust-process-windows 991 76%
- window--process-window-list 991 76%
- walk-windows 991 76%
- #<compiled 0x44b2ba69> 991 76%
- internal--after-save-selected-window 991 76%
- select-window 991 76%
- apply 991 76%
- #<compiled 0x454444c9> 785 60%
- forge-sql 785 60%
- apply 785 60%
- emacsql 785 60%
- apply 785 60%
- #<compiled 0x40c40573> 785 60%
- apply 785 60%
- #<compiled 0x460d9eed> 785 60%
- apply 785 60%
- #<compiled 0x4d90fc81> 785 60%
- apply 785 60%
- #<compiled 0x4580358d> 785 60%
- emacsql-send-message 782 60%
- apply 782 60%
- #<compiled 0x41640333> 782 60%
- apply 782 60%
- #<compiled 0x45fb4871> 780 60%
- emacsql-log 780 60%
- apply 780 60%
- #<compiled 0x45fb4865> 780 60%
- princ 780 60%
- auto-rename-tag-before-change-functions 780 60%
- auto-rename-tag-inside-tag 780 60%
- auto-rename-tag-backward-char-at-point 779 60%
- auto-rename-tag-backward-goto-char 670 51%
auto-rename-tag-current-char-equal-p 523 40%
So, I think there are two issues--the before-change hook is firing in places I wouldn't necessarily expect, and when it does fire, it is slow. Would a looking-back
based implementation be faster?
Thanks again for making this and releasing it.
First, thanks for this. It is a good idea.
It works for me in html files but not in xml files.
For example, changing target in this file bellow does not change the good tags.
<?xml version="1.0" encoding="UTF-8"?>
<project name="test">
<target name="test1">
<exec executable="g">
<arg file="new" />
</exec>
</target>
<target name="test2">
<echoproperties />
</target>
</project>
Regards
div
in this code made changes to the wrong place:export const NavBarLayout = ({ children, pageTitle }: Props) => (
<>
<Head>
<title>{pageTitle}</title>
</Head>
<div className="h-screen flex flex-col overflow-y-hidden">
<nav className="border-b border-b-4">
<div className="px-4 sm:px-6 lg:px-8">
<div className="flex items-center justify-between h-16">
<div className="flex items-center">
<div className="flex-shrink-0 text-center flex items-center">
<img
className="mx-auto h-6 w-auto"
src="/other-logo.svg"
alt="Other Logo"
/>
<span className="mx-4 text-4xl">+</span>
<img
className="mx-auto h-16 w-auto transform"
style={{ '--transform-rotate': '14deg' } as any}
src="/logo.png"
/>
</div>
</div>
</div>
</div>
</nav>
<div className="bg-white shadow-sm">
<div className="py-4 px-4 sm:px-6 lg:px-8">
<h1 className="text-lg leading-6 font-semibold text-gray-900">
{pageTitle}
</h1>
</div>
</div>
<div className="flex flex-1 py-6 overflow-y-hidden bg-cool-gray-100">
{children}
</div>
</div>
</>
)
Refer to #3 (comment)
Hello,
thanks for your code, it is indeed great idea.
Unfortunately the code seems to be unfriendly to XML namespaces. I ran into following issues with this example:
<a xmlns:a="test">
<x>ups</x>
<a:y>ups</a:y>
<a:z>ups</a:z>
</a>
Thanks!
Nice package, it saves quite a lot of typing!
However, I'm having an issue with some tags. The pattern I've found is that their name contain uppercase letters, e.g. <camelCase>
. Such tags seem not to be recognized by the auto-rename-tag-mode, at least they aren't updated.
This happens to me when I'm editing XML, where there are various conventions for how tags should be named.
When auto-rename-tag is activate, I can't query replace, I'm getting this error: replace-match-maybe-edit: Match data clobbered by buffer modification hooks
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Starbuzz Coffee</title>
<link rel="stylesheet" type="text/css" href="starbuzz.css" />
</head>
<body>
<header>
<img
id="headerLogo"
src="images/headerLogo.gif"
alt="Starbuzz Coffee logo image"
/>
<img
id="headerSlogan"
src="images/headerSlogan.gif"
alt="Providing all the caffeine you need to power your life."
/>
</header>
<div id="tableContainer">
<div id="tableRow">
<div id="drinks">
<h1>BEVERAGES</h1>
<p>House Blend, $1.49</p>
<p>Mocha Cafe Latte, $2.35</p>
<p>Cappuccino, $1.89</p>
<p>Chai Tea, $1.85</p>
<h1>ELIXIRS</h1>
<p>
We proudly serve elixirs brewed by our friends at the Head First
Lounge.
</p>
<p>Green Tea Cooler, $2.99</p>
<p>Raspberry Ice Concentration, $2.99</p>
<p>Blueberry Bliss Elixir, $2.99</p>
<p>Cranberry Antioxidant Blast, $2.99</p>
<p>Chai Chiller, $2.99</p>
<p>Black Brain Brew, $2.99</p>
</div>
<div id="main">
<h1>QUALITY COFFEE, QUALITY CAFFEINE</h1>
<p>
At Starbuzz Coffee, we are dedicated to filling all your caffeine
needs through our quality coffees and teas. Sure, we want you to
have a great cup of coffee and a great coffee experience as well,
but we're the only company that actively monitors and optimizes
caffeine levels. So stop by and fill your cup, or order online with
our new Bean Machine online order form, and get that quality
Starbuzz coffee that you know will meet your caffeine standards.
</p>
<p>
And, did we mention <em>caffeine</em>? We've just started funding
the guys doing all the wonderful research at the
<a
href="http://buzz.wickedlysmart.com"
title="Read all about caffeine on the Buzz"
>Caffeine Buzz</a
>. If you want the latest on coffee and other caffeine products,
stop by and pay them a visit.
</p>
<h1>OUR STORY</h1>
<p>
"A man, a plan, a coffee bean". Okay, that doesn't make a
palindrome, but it resulted in a damn good cup of coffee. Starbuzz's
CEO is that man, and you already know his plan: a Starbuzz on every
corner.
</p>
<p>
In only a few years he's executed that plan and today you can enjoy
Starbuzz just about anywhere. And, of course, the big news this year
is that Starbuzz teamed up with Head First readers to create
Starbuzz's Web presence, which is growing rapidly and helping to
meet the caffeine needs of a whole new set of customers.
</p>
<h1>STARBUZZ COFFEE BEVERAGES</h1>
<p>
We've got a variety of caffeinated beverages to choose from at
Starbuzz, including our
<a href="beverages.html#house" title="House Blend">House Blend</a>,
<a href="beverages.html#mocha" title="Mocha Cafe Latte"
>Mocha Cafe Latte</a
>,
<a href="beverages.html#cappuccino" title="Cappuccino">Cappuccino</a
>, and a favorite of our customers,
<a href="beverages.html#chai" title="Chai Tea">Chai Tea</a>.
</p>
<p>
We also offer a variety of coffee beans, whole or ground, for you to
take home with you. Order your coffee today using our online
<a href="form.html" title="form.html">Bean Machine</a>, and take the
Starbuzz Coffee experience home.
</p>
</div>
<div id="sidebar">
<p class="beanheading">
<img src="images/bag.gif" alt="Bean Machine bag" />
<br />
ORDER ONLINE with the
<a href="form.html">BEAN MACHINE</a>
<br />
<span class="slogan">
FAST <br />
FRESH <br />
TO YOUR DOOR <br />
</span>
</p>
<p>
Why wait? You can order all our fine coffees right from the Internet
with our new, automated Bean Machine. How does it work? Just click
on the Bean Machine link, enter your order, and behind the scenes,
your coffee is roasted, ground (if you want), packaged, and shipped
to your door.
</p>
</div>
<!-- sidebar -->
</div>
<!-- tableRow -->
</div>
<!-- tableContainer -->
<div id="footer">
© 2012, Starbuzz Coffee
<br />
All trademarks and registered trademarks appearing on this site are the
property of their respective owners.
</div>
</body>
</html>
When i try to rename <div id="footer">
, or <div id="sidebar">
, both of them not work.
thanks
Refer to #3 (comment)
Works fine in html-mode
but has no effect using web-mode
. Using emacs 26.1 on Arch Linux.
When trying to use replace-string
in an HTML buffer with auto-rename-tag-mode
enabled, I get the error perform-replace: Match data clobbered by buffer modification hooks
. If I turn off auto-rename-tag-mode
, replace-string
works fine replacing all matching occurences. Otherwise, replace-string
will exit with the above error message replacing only the first match.
I've confirmed that the issue is with auto-rename-tag
package itself by testing with emacs -Q
.
Please let me know if I need to provide any extra information, thanks.
Hey hello, thank you for this very useful package :) I really like to use it for React/React Native. I have found a little issue though and I don't know how to fix it:
It looks like there is some conflict with JSX expressions. Let me know if the GIF is helpful and if I can provide any more data for debug. Cheers :)
this is the init.el
file
(load "~/.emacs.d/elpa/auto-rename-tag-20220616.1856/auto-rename-tag.el")
(require 'auto-rename-tag)
(add-hook 'html-mode-hook #'auto-rename-tag-mode)
Assuming this demo.html
has some conflicts and smerge-mode
turned on
when smerge-mode
turned on, if I do smerge-keep-upper(C-c ^ u)
, the merge result will become this
if I do smerge-keep-lower (C-c ^ l)
, the merge result will become this
React code is capable of having some confusing stuff like tags inside a prop. If you change the top WhenRole
here, it will change the bottom one as well.
<WhenRole
render={() => (
<li>
test
</li>
)}
/>
<WhenRole />
I'm sorry for the flurry of issues... it's only because I like this package.
This one is somewhat esoteric as well, so if you don't intend to support typescript, I totally understand if you'd want to close this.
Start with this:
const x = () => (
<Foo>
test
</Foo>
)
Update top <Foo>
to <Foo<Bar>>
That will change the bottom </Foo>
to </Bar>
:
const x = () => (
<Foo<Bar>>
test
</Bar>
)
Then put your point before the B
in </Bar>
and C-d
, that will hang Emacs until you spam C-g
.
The auto-rename-tag-mode
will not work anymore until you disable it and reenable it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.