Threads for xenodium

  1. 7

    Hi, it looks like you’re posting a lot of stories authored by yourself. It’s great that you want to share your writing and projects with the community, but sharing only or mostly that comes across as self-promotion. As a rule of thumb, I think at least half of a user’s submissions should be authored by other people. Please try to find more things to share besides your own work before posting more self-authored links.

    1. 1

      Ah yes. The content is often either howto posts or open source packages I have worked on, since I have knowledge in the space. I’m happy to mix it up more if needed.

      1. 1

        It’s really about contributing to other kinds of conversations outside of only those you’ve posted. And/or sharing interesting things that you did not create yourself.

    1. 2

      You might want to look into the new ScreenCaptureKit API instead.

      1. 1

        Thanks! I’ll have to play with it. One thing I want ensure is if I generate gif or webp, the resulting animation should keep transparency around the round window corners. I’m getting it from current solution. Do you know if ScreenCaptureKit does?

      1. 3

        I don’t think anyone should encourage anyone to produce videos in GIF (/dʒɪf/) format. There are many better alternatives: APNG, H264, WEBP, etc.

        1. 3

          Added .mov for now (same as default on macOS). Will look at others.

        1. 2

          I’m personally fond of (global-)hl-line-mode.

          1. 1

            it has tiny yet a noticeable lag, especially on Mac. Once I felt it I couldn’t use it anymore. I sometimes turn it on for specific buffers.

            1. 1

              It’s completely synchronous with moving the point on my setups (2x macbooks, 1x linux desktop).

            2. 1

              Good one! I used to have that also. I think I disabled it after switching to a box orange cursor.

            1. 3

              Thanks for all your elisp contributions, and, more importantly, thanks for your write-ups! They are concise, informative and playful. Very Emacsy.

              Since I started reading you, I’ve been much more bold in reaching for a few dozen lines of elisp to scratch an itch here and there.

              1. 1

                Thank you! That’s really nice to hear. Scratching an itch with elisp can be so fun and satisfying! Glad these help.

              1. 1

                Interesting! Does this have facilities to send code to the shell so you can ask chatgpt about the code?

                1. 2

                  Yes. Can send region. Can also ask about what went wrong with last eshell command. Explain code.

                  Look for whatever is available via M-x in same namespace.

                  Edit: typos

                  1. 1

                    Awesome, def going to try it.

                1. 2

                  I use org-tree-slide mode and did not know about org-present. Would someone know how the two compare? (I can’t tell from looking at the org-present page.)

                  (Edit: opened an upstream issue to encourage the author to include such a comparison in their README.)

                  1. 3

                    Not a direct comparison but David on System Crafters has videos on each:

                  1. 4

                    For Emacs enthusiasts, https://emacs.ch is wonderful. It’s got a growing level of Emacs engagement I hadn’t seen for some time.

                    1. 4

                      Ok, but all of this is sh, not emacs, right?

                      1. 5

                        it is about emacs letting you compose the functions provided by the utilities, provide ways to trigger (M-x or even a key combination when used often), and provide a presentation of the result.

                        1. 4

                          As an Emacs user, if the feature is well integrated and useful, I’m not too fussy about its implementation.

                          The feature, though using a tiny shell script and command line utility, is surfaced via Emacs M-x. It knows whether to apply functionality to current image buffer or file selection in dired. When I use it, I interact with Emacs.

                          1. 3

                            Or really, perl (exiftool).

                          1. 1

                            I’m still learning AppKit, but couldn’t you enumerate the sharing services and display them in an Emacs buffer?

                            Also, why not bridge Objective-C directly from elisp?

                            1. 2

                              Ah yes to both :) The post is low-effort trickery. No need to check out sources, recompile, etc. yet functional enough.

                              1. 3

                                but couldn’t you enumerate the sharing services and display them in an Emacs buffer?

                                @calvin Try v0.25 or this change: https://github.com/xenodium/dwim-shell-command/commit/20e782b4bf1ea01fecfce3cc8ac4c5a74518cd80

                                1. 1

                                  I don’t use Emacs, but neat!

                                  For Objective-C bridging, other than to add it if it’s not there, it would mean being able to call these APIs directly from elisp, by having things like i.e. objc_msgSend - it’d run in-process and avoid calling a compiler.

                              1. 2

                                Are you offering show-in-finder in that init as a simpler alternative? It doesn’t seem to handle multiple file selection like the post’s animation?

                              1. 1

                                This looks great! Seems to hang when I undo, though. (Using Doom Emacs.)

                                1. 3

                                  This looks great!

                                  Thank you.

                                  Seems to hang when I undo, though. (Using Doom Emacs.)

                                  Experiment kind of quality for sure =P

                                  ok, threw in a (not undo-in-progress) in there and seems to do the job. Patched the post, but may take a few minutes to show up. Here’s the snippet.

                                  (when (and (> end beginning)
                                             (eq length 0)
                                             last-edit-time
                                             (not undo-in-progress) ;; <------- new
                                             ;; 0.27 seems to work for my macOS keyboard settings.
                                             ;; Key Repeat: Fast | Delay Until Repeat: Short.
                                             (< (- edit-time last-edit-time) 0.27)
                                             (float-time (time-subtract (current-time) edit-time))
                                             (accent-menu-monitor--buffer-char-string (1- beginning))
                                             (seq-contains-p (mapcar (lambda (item)
                                                                       (symbol-name (car item)))
                                                                     accent-diacritics)
                                                             (accent-menu-monitor--buffer-char-string beginning))
                                             (string-equal (accent-menu-monitor--buffer-char-string (1- beginning))
                                                           (accent-menu-monitor--buffer-char-string beginning)))
                                    (delete-backward-char 1)
                                    (ignore-error quit
                                      (accent-menu)))
                                  
                                  1. 1

                                    Nice! That worked. Thanks! :)

                                1. 2

                                  This is the reason I have alias vim=‘emacsclient -nc’

                                  And relatedly the reason that I install dtrx on every machine I touch.

                                  1. 2

                                    Lol. I had the same vim alias but memory willingly moved over to ec (emacsclient alias).

                                    Thanks. TIL about dtrx.

                                    1. 1

                                      Yep. And I have some more of that sort:

                                      alias ecc='emacsclient -c'
                                      alias eccn='emacsclient -c -n'
                                      alias ecn='emacsclient -n'
                                      alias ecnw='emacsclient -c -nw'
                                      

                                      (I should use them more often. I actually forgot about them until this comment. :-)

                                      Another set of aliases which I consider life hacks of this kind, i.e. which I use all the time:

                                      Git related
                                      alias amend='git commit --amend'
                                      alias ga='git annex'
                                      alias gap='git add -p'
                                      
                                      APT-related or otherwise debian-specific
                                      alias acs='apt-cache show --no-all-versions'
                                      alias acp='apt-cache policy'
                                      alias acr='apt-cache rdepends'
                                      alias ac/='apt-cache search'
                                      alias acn='apt-cache search -n'
                                      alias af/='apt-file search'
                                      alias afl='apt-file list'
                                      alias acsrc='apt-cache showsrc'
                                      # Use like "btsmutt 123456" to open a Debian bug report in mutt
                                      alias btsmutt='bts --mbox show'
                                      

                                      (Aliases with a slash in their name IIRC don’t work in Bash, but they do work in Zsh. So I mostly don’t care about that detail.)

                                      And yeah, in the meanwhile I could replace apt-get and apt-cache in most of these with just apt. I’d though still keep the alias names due to muscle memory…

                                      SSH related
                                      # My "get me a remote screen session and stay connected no matter how" command
                                      function asc() {
                                          # Set the title to something more obvious, e.g. the expanded
                                          # alias, eh, function
                                          print -Pn "\e]0;%n@%m: autossh -t $* 'screen -RdU'\a";
                                      
                                          # For the following hack for getting ssh-agent to work inside the
                                          # reattached screen session, see
                                          # http://samrowe.com/wordpress/ssh-agent-and-gnu-screen/ and
                                          # http://www.stderr.nl/Blog/Software/Mutt/MuttRemoteAttachments.html?seemore=y
                                          autossh -x -A -t "$@" 'screen -RdU'
                                      }
                                      compdef asc=ssh
                                      

                                      (Granted, it’s a bit too complex for an alias and that compdef thingy is zsh-specific, but not required.)

                                      Others
                                      alias t=task
                                      
                                      1. 2

                                        Thanks. Interesting to see. I used to have many equivalents to these. Over time, they have gradually dissapeared to Emacs flows (ie. magit). If invoking shell utils, I now use dwim wrappers for password protecting pdfs, creating macOS icons, and all others here.

                                        1. 1

                                          Learning how to use magit is still on my TODO list. I bascially do all git stuff on the commandline and use emacsclient to edit files in the already running Emacs instance from the commandline.

                                          And thanks for these links. I think I should read quite some of your Emacs/DWIM related postings. :-)

                                  1. 2

                                    Regarding the “would love to hear of others”: In Debian there are also the packages unp, zutils and patool:

                                    • unp is what I actually use as “DWIM unzip” command, because unzip is heavily tied to this annoying ZIP format used on Windows all the time. ;-)

                                    • And then there’s also zutils which replaces zcat, zgrep and friends which generic wrappers which also support bzip2, xz, lzma and other compression formats. The cool thing here is that this way you can zgrep through files with different compression formats in one go. And you never have to think anymore about if that one command is named bz2grep, bzgrep2 or just bzgrep. :-)

                                    • Another one I’m aware of, but never really used it, is patool.

                                      EDIT: When looking through my shell aliases, I noticed that I was actually using patool quite often, because atool offers adiff but not an agrep. So I built it via alias agrep='patool search'. But I’m only using this for multi-file archive formats. Because for just compressed single file archives, there’s the zgrep from zutils which I use way more often.

                                    Oh, and I of course also use atool, but mostly only one of its commands, namely als.

                                    HTH

                                    1. 2

                                      Thanks for these. They look great. I’ll add them to the post also. All new to me.

                                      The cool thing here is that this way you can zgrep through files with different compression formats in one go. And you never have to think anymore

                                      Didn’t know about zutils, but big fan of the approach. ripgrep-all does a great job here. Their readme shows how diverse the set can be:

                                      demo/
                                      ├── greeting.mkv
                                      ├── hello.odt
                                      ├── hello.sqlite3
                                      └── somearchive.zip
                                      ├── dir
                                      │ ├── greeting.docx
                                      │ └── inner.tar.gz
                                      │ └── greeting.pdf
                                      └── greeting.epub
                                      
                                      1. 1

                                        My alternative option is to install The Unarchiver.app on macOS and then just use open foo.zip and it will usually do what I need =)

                                    1. 1

                                      The aunpack alias is very easy to remember already.

                                      1. 1

                                        aunpack

                                        Not sure how I missed this existing alias. Thank you.

                                      1. 5

                                        I use bsdtar for this on Arch Linux. It’s the libarchive backed tar implementation from FreeBSD. It handles all formats you usually encounter. I have it aliased to tar for muscle memory reasons.

                                        1. 3

                                          Thanks. TIL about bsdtar.

                                        1. 2

                                          There’s the great atool wrapper out there to extract all kinds of archives (would love to hear of others)

                                          https://github.com/mholt/archiver is an alternative, written in pure Go so a self-contained binary

                                          1. 4

                                            atool supports many more formats.

                                            1. 1

                                              Thank you! Didn’t know about it.

                                              1. 1

                                                The thing to say about atool is that it includes the aunpack command which fits the article’s description, is prevalent and is muscle memory safe: It recognizes file formats and it defuses archive bombs (creates a directory named after the archive if the archive lacks a toplevel directory).

                                                1. 2

                                                  That’s not what my understanding of a zip bomb is, I always assumed it referred to archives which produce unreasonably massive output. See https://en.wikipedia.org/wiki/Zip_bomb

                                                  1. 2

                                                    I think it depends on where you come from what the prevalent problem is. I’m more used to “archive bomb” meaning “tar bomb”. It is unfortunate that an insignificant file format difference means so different things:

                                                    • Tar bomb: Archive containing multiple toplevel files
                                                    • Zip bomb: Something that is too big to decompress
                                              1. 1

                                                Neat trick!

                                                There seem to be some terrible aliasing in the GIFs on my screen. I’d recommend using one of those terminal stream recorders instead, resulting in animated SVGs.

                                                1. 1

                                                  ah good idea. thank you. is there one you used before?

                                                  1. 1

                                                    Haven’t used any of them myself, but the first one that pops into my mind is asciinema

                                                  1. 1

                                                    glad I’m not the only iOS dev using emacs!

                                                    1. 1

                                                      High-five! There’s three of us now ;) I’d love more iOS/emacs tips! Do share. I try to document mine at https://xenodium.com