fixing a bunch of broken stuff I think
This commit is contained in:
parent
0dbc3ead0e
commit
8bace887a2
1551 changed files with 299 additions and 57481 deletions
|
@ -1 +0,0 @@
|
|||
<!-- SC_OFF --><div class="md"><p>HI Greetings to all, I recently Installed Arch on my VM ware but whenever I install any application using pacman in the terminal the desktop entry the apps won't have any icon I installed Firefox first it didn't had any symbol after searching a bit I found out that Firefox had an issue with arch for some time(but it was from 2 year ago) so to test it again I installed mousepad this time also the application icon was missing it in the desktop entry both firefox and mousepad are showing up like <a href="https://i.imgur.com/slFVneC.png">this</a> </p> <p>can anyone help me with this.</p> </div><!-- SC_ON -->   submitted by   <a href="https://www.reddit.com/user/Anish_Gowda"> /u/Anish_Gowda </a> <br/> <span><a href="https://www.reddit.com/r/archlinux/comments/radjop/arch_not_creating_icon_desktop_entries_for_new/">[link]</a></span>   <span><a href="https://www.reddit.com/r/archlinux/comments/radjop/arch_not_creating_icon_desktop_entries_for_new/">[comments]</a></span>
|
|
@ -1,38 +0,0 @@
|
|||
<p>A couple of days ago, I did maybe the weirdest and also most amazing thing on a remote machine thus far (with Emacs) and wanted to share the story.</p>
|
||||
|
||||
<p>So there’s this EmulationStation software that organizes roms with XML lists for metadata. I needed to change the <code><name></code> field of about 100 entries there to drop a numeric prefix. That’d be easy on my local computer with tools I know well, but I was accessing the device remotely via SSH and wanted to see what I could do.</p>
|
||||
|
||||
<p>I’m not very good at plain shell scripting which would’ve been an option, so I fired up Emacs to make a connection to the device.</p>
|
||||
|
||||
<p>For all intents and purposes, what you see from within Emacs locally is indistinguishable from what you see when logged into a remote machine. This helps with my <em>effectivity</em>, because then I can use the tools I know well to do things on remote machines, too. This is different from SSH’ing onto the machine and opening an editor there, because opening emacs/vi/nano on the remote machine would be loading that machine’s configuration. If you open your local Emacs and create a connection to the remote machine from there, your local configuration will be used. It’s just like live editing web pages via FTP as we did it in the 90’s.</p>
|
||||
|
||||
<p>The only exception are locally installed packages that interface with locally installed command-line tools (e.g. <code>ag</code> or <code>ripgrep</code>). The functions will be available, but executing these programs on the remote machine won’t work. The binary won’t be found.</p>
|
||||
|
||||
<p>So the game metadata files I needed to adjust are grouped into directories, one per system. That meant I needed to find all <code>gamedata.xml</code> files in all directories first. Then find the numerical prefixes within each (and replace them). I’m able to perform both tasks individually from the shell, but the combination would’ve already required some research, especially since my local machine has non-POSIX tools like <a href="https://github.com/sharkdp/fd"><code>fd</code></a> installed that I got used to, while the remote device is a bare-bones Linux. I’m also used to <code>grep</code> replacements, which made the search-and-replace operation a bit cumbersome. But that wouldn’t be a problem with Emacs as you’ll see in a second.</p>
|
||||
|
||||
<p>A simple regex for the numerical prefixes is <code><name>\d\d\d\s</code>, and the replacement string would be <code><name></code>. Emacs regular expressions are weird because you have to escape parens and brackets that are part of the PCRE syntax. <a href="https://www.reddit.com/r/emacs/comments/rk5t3b/do_you_use_interactive_regexp_replace_with_emacs/">There’s a snippet to help with that</a> so you can write the syntax you know and have it translated to Emacs-escaped regex. I didn’t know of that, sadly, and experimented around until I found that <code><name>[0-9]\{0,3\} </code> works (note the trailing space). TIL: The curly braces require escaping, and neither <code>\d</code> nor <code>\s</code> seem to work.</p>
|
||||
|
||||
<p>Now here are the steps I took:</p>
|
||||
|
||||
<ul>
|
||||
<li>Install <code>wgrep</code> package if you don’t have it already. It makes grep buffers <em>writeable</em>. That means you can perform changes to search result buffers in-place and save them in bulk.</li>
|
||||
<li>Run <kbd>M-x rgrep</kbd> for recursive search:
|
||||
<ul>
|
||||
<li>Search for <code><name></code></li>
|
||||
<li>Specify the file wildcard as <code>*.xml</code></li>
|
||||
<li>Specify the root folder from which to start recursive search</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>In the results buffer that appears, hit <code>w</code> or <kbd>M-x wgrep-change-to-wgrep-mode</kbd> to make the grep results buffer writeable.</li>
|
||||
<li>Run <kbd>M-x replace-regex</kbd> and replace <code><name>[0-9]\{0,3\} </code> (again, note the trailing space) with <code><name></code>.</li>
|
||||
<li><em>To save all changes to all matched files</em>, hit <kbd>C-c C-c</kbd>.</li>
|
||||
</ul>
|
||||
|
||||
<p>And that’s it!</p>
|
||||
|
||||
<p>The magic piece here is that Emacs will open, modify, and save all files according to the “diff” you produce in <code>wgrep</code> or “writable grep” mode. I didn’t have to figure out how to search recursively for the pattern in all XML files and afterwards perform the replacement automatically.</p>
|
||||
|
||||
<p>On my Mac, I would’ve been able to achieve this 10+ years ago with TextMate (or BBEdit), too. Local changes never were much of a problem.</p>
|
||||
|
||||
<p>But with Emacs, I was able to do these changes remotely. The hardest part was figuring out how to escape what in the regex. (I used <code>highlight-regexp</code> to more or less interactively highlight matches.)</p>
|
||||
<hr /><p>Receive Christian’s <a href="https://christiantietze.de/newsletter/">new posts via email</a></p>
|
|
@ -1 +0,0 @@
|
|||
<table> <tr><td> <a href="https://www.reddit.com/r/unixporn/comments/r558vk/kde4_welcome_to_the_past/"> <img src="https://preview.redd.it/46ffrukvjl281.png?width=640&crop=smart&auto=webp&s=662e4eea5be1e27a8ecf61318222a42c044418c6" alt="[KDE4] Welcome to the past!" title="[KDE4] Welcome to the past!" /> </a> </td><td>   submitted by   <a href="https://www.reddit.com/user/hqsqdev"> /u/hqsqdev </a> <br/> <span><a href="https://i.redd.it/46ffrukvjl281.png">[link]</a></span>   <span><a href="https://www.reddit.com/r/unixporn/comments/r558vk/kde4_welcome_to_the_past/">[comments]</a></span> </td></tr></table>
|
|
@ -1 +0,0 @@
|
|||
<table> <tr><td> <a href="https://www.reddit.com/r/unixporn/comments/r1g6oe/spectrwm_my_first_attempt_at_rice_better_one/"> <img src="https://preview.redd.it/ro8osx527m181.png?width=640&crop=smart&auto=webp&s=fd33b3dae063966fb15b90f4d3d0d6e3beeecd70" alt="[spectrwm] My first attempt at rice (better one coming soon™)" title="[spectrwm] My first attempt at rice (better one coming soon™)" /> </a> </td><td>   submitted by   <a href="https://www.reddit.com/user/Parn23"> /u/Parn23 </a> <br/> <span><a href="https://i.redd.it/ro8osx527m181.png">[link]</a></span>   <span><a href="https://www.reddit.com/r/unixporn/comments/r1g6oe/spectrwm_my_first_attempt_at_rice_better_one/">[comments]</a></span> </td></tr></table>
|
Loading…
Add table
Add a link
Reference in a new issue