emacs Emacs Complex Capture Template: rx '**' range error?
Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    4 months ago 100%

    I'm not 100% sure what you're referring to, but having #' before a function is is to tell the reader/compiler that you're specifically referring to the function of the name that comes after it. You could just do ' and that works in Emacs Lisp, but it's more technically correct in this case to do #' as org-deadline is a function.

    If that's not what you're referring to, I apologize.

    3
  • emacs
    Emacs AlecStewart1st 4 months ago 100%
    Complex Capture Template: rx '**' range error?

    Hello, friends! So I have a complex way of capturing TODO tasks for today or week. Someone will probably tell me that there's a package out there somewhere to do this easier, but regardless I would like to figure this out. Here's the function I use: (defun org-capture::today-task-tree () "Create a task tree for tasks TODO today." (let* ((time-string (format-time-string "<%Y-%m-%d %a>" (current-time))) (heading (concat "[%] " time-string)) (heading-rx (rx (group "[" (0+ num) "%]") (0+ space) (group (literal time-string))))) (goto-char (point-max)) (if-let (pnt (re-search-backward heading-rx nil t)) (goto-char pnt) (goto-char (point-max)) (or (bolp) (insert "\n")) (insert "* " heading "\n") (beginning-of-line 0)) (org-end-of-subtree))) And here's the `org-capture-templates` entry: ("gt" "Today: A task for today" entry (file+function ,(expand-file-name "~/Documents/Org/GTD/work.org") org-capture::today-task-tree) (file ,(concat my-emacs-dir "capture-templates/datetree-weekly-tasks.tmplt")) :empty-lines-after 1 :after-finalize (lambda () (org-update-statistics-cookies t))) And here's the actual capture template that I store in a file in my config: ** [ ] [#%^{Priority}] %^{Task name} %(funcall-interactively #'org-deadline nil (current-time)) %^g %? %i Now when I'm in that file `~/Documents/Org/GTD/work.org` and I run the above function with `M-: org-capture::today-task-tree` it works fine. An example of what the file will look like it: * [100%] 2024-04-27 Mon ** [X] Do something important this Monday #[A] :work: CLOSED: 2024-04-27 Mon 12:42 DEADLINE: 2024-04-27 Mon * [%] 2024-04-28 Tues ** [ ] Do something else that's not as important #[B] :personal: DEADLINE: 2024-04-27 But for whatever reason when I run `org-capture` and finish the capture with `C-c C-c` or refile with `C-c C-w` I get rx--translate-bounded-repetition: rx ‘**’ range error Which I don't really know what that means nor how to fix it, and I can't really find anything useful via searching the internet at the moment. A possible thing to not is that I [disable Org's element caching](https://codeberg.org/alecStewart1/dots/src/commit/509d89c9f2a0c8a057ebc916e0784466c9be6b73/emacs/.emacs.d/lisp/writing.el#L565). If you want to look at my configuration to dig around some, you can find it [here](https://codeberg.org/alecStewart1/dots/src/branch/main/emacs/.emacs.d) and the part where my configurations for Org-Mode are [here](https://codeberg.org/alecStewart1/dots/src/commit/509d89c9f2a0c8a057ebc916e0784466c9be6b73/emacs/.emacs.d/lisp/writing.el#L85).

    4
    3
    selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    4 months ago 100%

    Plus, ZFS supports native encryption!

    Hmm, I think that was the one I was wondering about. I use Gentoo, and when I was initially setting everything up on my machine, I saw there were a lot of caveats for using ZFS on linux from the Gentoo wiki entry on it. Maybe that's changed or those issues are no longer related to native encryption specifically.

    1
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 100%

    Is ZFS on Linux getting better? I've heard mixed things. I use BTRFS on my daily driver, and I really like (ab)using the file compression with zstd.

    1
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 100%

    If you are not too stuck on bsd

    Not really. It's more out of the curious of how DragonflyBSDs HAMMER2 filesystem works. I've good things about it and ZFS on FreeBSD. ZFS on Linux I've heard is still getting up to where it is on FreeBSD.

    1
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 100%

    It's the interest in how well the HAMMER2 filesystem works for everyday storage, as well as how swapcache performs. Not much besides that, plus I've generally decent experiences with Net and OpenBSD.

    https://www.dragonflybsd.org/performance/

    1
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 100%

    If you’re gonna spend that level of money, you may as well go for an M1 Mac Mini.

    I was joking. I don't feel like shelling out $600 for a starting media server.

    2
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 100%

    If you really want Intel, just get an N100 or N300. Low power, Intel HW transcoding on iGPU on Linux kernels 6.3+, and can handle Jellyfin no problem.

    Didn't think about that either. I'm finding I didn't give this as much thought as I should've.

    You can get a minipc with everything you for $175 for a no name brand, or maybe $250 for a more well-known brand.

    But why do that when I could spend +$600? 😜

    4
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 100%

    Good point. So what we're really talking about then is

    • something like a raspberry pi
    • 1 or 2 hard drives for base storage
    • 1 external hard drive as a backup
    3
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 100%

    I mean, right now, that's definitely not on the table.

    4K would be nice, obiviously, but I don't think I myself am to act nor do I want to act as the alternative to Plex for a bunch of family and friends. 😆

    1
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 100%

    I'm beginning to realize I haven't looked into this as much as I should've. 😅 So for most people, with what @AtariDump@lemmy.world has mentioned, a raspberry pi with 1 or multiple hard drives (if you really want) is a good start.

    2
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 66%

    As the project mentions:

    Even though there are builds available online for these platforms, they are unofficial and from a separate project. If you do encounter issues on these platforms, please ask for support in their respective support channels first.

    This that project:

    https://github.com/Thefrank/jellyfin-server-freebsd

    1
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    5 months ago 100%

    Ah, okay. So, if I understand correctly, unless I'm trying to have Jellyfin do what YouTube does with offering multiple resolutions and bitrates for video, I don't need to bother with looking for a GPU that's good at video transcoding?

    6
  • selfhosted Selfhosted Recommendations for Hardware for Physical Media/Jellyfin Server
    Jump
    selfhosted
    Selfhosted AlecStewart1st 5 months ago 93%
    Recommendations for Hardware for Physical Media/Jellyfin Server

    ### Initial Thoughts Hello friends! This is something that's been muddling around in my mind for a bit, in part because I now have a decent collection of DVDs, and I am starting get a digital collection of shows that are a bit hard to find. I'm also interested in the fact that there's a [TubeArchivist plugin for Jellyfin](https://github.com/tubearchivist/tubearchivist-jf-plugin), as media archival interests me and YouTube is starting to suck with Google's position on ad-blocking. It would be nice to be able to access this stuff anywhere as well, so creating a media/Jellyfin server seems like a good solution. Thing is I'd rather have a physical server than pay a bunch of monthly fees for VPS hosting. Not knocking it of course, but on top of monthly fees I also have my skepticism about VPS hosts and if they're sharing data with people regarding my use of their service. ### Completely wishful thinking setup I'm not so much of a hardware guy as I am a software guy, funnily enough, but to give you an idea of what I would like here's my admittedly wishful thinking of what I'd like for a setup: - [DragonflyBSD](https://www.dragonflybsd.org/) as the server OS, utilizing it's HAMMER2 filesystem and [swapcache](https://www.dragonflybsd.org/performance/) as I've heard great things about those. - Jellyfin, obviously. - NVMe SSD storage with some level of RAID. - Intel GPU, as I've *heard* they're very good at video decoding, but I've not looked into evidence of this. - Whatever CPU and RAM I can get good performance out of without wasting money. - Add it to the Wireguard network so I can watch stuff anywhere. A few things with this: 1. I don't know how up-to-date DragonflyBSD's [dport of Jellyfin](https://github.com/DragonFlyBSD/DPorts/tree/master/multimedia/jellyfin) is, but maybe this is something worth contributing to. 2. God only knows if the new Intel graphics card drivers work well on the BSDs. I know all of the BSDs basically just pull from the official Linux firmware for graphics (I think?). 3. I'd have to figure out if any other hardware would not play well with DragonflyBSD, probably not too big of an issue but it's still something to look out for. 4. Cost of hardware. ### Wrap up Overall it probably be just me and my wife who would use the server, mostly me. Maybe some immediate family, a few friends, maybe down the line use it for kids when we have them. What are your recommendations?

    37
    53
    emacs Emacs Using gopass with Emacs
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    7 months ago 100%

    Interesting. Do you enable the auth-source backend for pass as well?

    Funnily enough, it seems Nicholas Petton (creator of the pass.el library) contributed to this. :)

    1
  • linux_gaming Linux Gaming Linux hits 4% on the desktop 🐧📈
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    7 months ago 100%

    2060 - The True and Definitive Year of the Linux Desktop (maybe, probably not but hopefully)

    2
  • emacs
    Emacs AlecStewart1st 7 months ago 100%
    Using gopass with Emacs

    Hey gang! So I've used [gopass](https://github.com/gopasspw/gopass) for awhile now, and Emacs for longer. I was wondering if any of you here interact with gopass via Emacs with `auth-source` or something similar. The main reason I ask is because I'm wanting to finally use Emacs for other things, such as an IRC client and making more use of Magit, and even writing with [750words](https://new.750words.com/). A lot of my passwords are stored with gopass, and the structure isn't always the same for stores. For instance: | Forums |-- Gentoo |-- Some other forum | | Email Host |-- email-address@somewhere.com |---- password |---- recovery codes | | Employer Name |-- Some program we use at work |---- myworkemail@work-site.com | | Some app |-- My User Name Maybe this structure for a password store is a no-no, though it's not a big deal to move things around. Any tips? I've seen [`auth-source-gopass`](https://github.com/triplem/auth-source-gopass), but that doesn't provide any interaction with selection of passwords or creation of passwords, I think. I've look at that mentioned library some and writing an `auth-source` backend doesn't seem too involved, but maybe I don't necessarily have to with `auth-source`. **EDIT:** A potential configuration that others might use: (require 'consult) (require 'auth-source-pass) (use-package pass :requires password-store :preface (defvar consult:pass-source `(:name "Passwords" :narrow ?< ;; maybe you want something else for narrow? :face pass-mode-directory-face ;; maybe you want to use a different face? :category pass :enabled ,(lambda () (auth-source-pass-file-name-p auth-source-pass-filename)) :items ,#'password-store-list) "Consult source for passwords with (go)pass.") (defun consult:pass (arg pass) "Stolen from Doom Emacs. https://github.com/doomemacs/doomemacs/blob/master/modules/tools/pass/autoload/consult.el" (interactive (list current-prefix-arg (progn (require 'consult) (consult--read consult:pass-source :prompt "(Go)Pass: " :sort nil :require-match t :category 'pass)))) (funcall (if arg #'password-store-url #'password-store-copy) pass)) :custom (password-store-executable (executable-find "gopass")) (auth-source-pass-filename (or (getenv "PASSWORD_STORE_DIR") (expand-file-name "~/.local/share/gopass/stores/root"))) :config (auth-source-pass-enable))

    13
    5
    linux_gaming Linux Gaming GE-Proton8-29 Released
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    8 months ago 100%

    I don't know about your second question, but with almost every proton-ge update I've gone into Steam and switched over to the new version with no issues so far.

    Maybe that's a no-no for some games but, again, no issues so far.

    EDIT: Same goes for wine-ge whenever I have games I bought through GOG and play through Lutris.

    7
  • emacs
    Emacs AlecStewart1st 10 months ago 100%
    [Question] Creating a complex capture structure, need some guidance

    Hey gang, so I've been attempting to create a more organized way to capture daily tasks in with org-capture and I'm having trouble figuring out the best way to do so. The structure I want is the following: ``` * [%] &lt;2023-11-10> ** [ ] #[A] Some title for a task due today :work: DEADLINE: &lt;2023-11-10> ``` The idea would be: 1. If a top level heading for today's date doesn't exist, create it and create a subheading 2. If a top level heading for today's date does exist, simply just add a subheading. At first, [I had a function](https://codeberg.org/alecStewart1/dots/src/commit/866955caf28c0b5c89e10c8f6936f609a0066019/emacs/.emacs.d/lisp/writing.el#L316) I tried to use that didn't work the way I wanted when I first wrote it. In retrospect, I don't know why I thought it would. Then I tried using [capture templates](https://codeberg.org/alecStewart1/dots/src/branch/main/emacs/.emacs.d/capture-templates/datetree-weekly-tasks.tmplt) but that doesn't meet the requirements. In rewriting the function I linked to previously, this is what I have so far: ```emacs-lisp (defun org-capture::today-task-tree () "Create a task tree for tasks TODO today." (let* ((time-string (format-time-string "&lt;%Y-%m-%d %a>" (current-time))) (heading-rx (rx (group "[" (0+ num) "%]") (0+ space) (group (literal time-string)))) (heading (concat "[%] " time-string))) (goto-char (point-max)) (if-let (pnt (re-search-backward heading-rx nil t)) (progn (goto-char pnt) (end-of-line) (insert "\n") (insert "** [ ] ") (beginning-of-line 0)) (goto-char (point-max)) (or (bolp) (insert "\n")) (insert "* " heading "\n") (beginning-of-line 0))))))) ``` Any suggestions? I just learned out the [Org Mapping API](https://orgmode.org/manual/Using-the-Mapping-API.html) but I'm not entirely sure if that'll suit my needs.

    8
    1
    greentext > Greentext Anon is disillusioned about Starfield
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    12 months ago 25%

    I only sample the finest 10/10 works of art

    No? I'll admit that something like Enderal: Forgetten Stories, while very fun and better than Skyrim in a lot of ways, is still like an 8/10 even though I like it a lot. If we're going on the game alone and not how great and generous the developers are to the community, Deep Rock Galactic is a 9/10.

    have no time for lowly 7/10 slop that the peasents enjoy.

    7/10 for Starfield is incredibly generous. It's a 5/10 if we're all being honest and not circlejerking about Bethesda.

    If only they'd accept that I know better what they should be allowed to enjoy

    You can like and play whatever you want.

    But if you share the opinion that overall quality of games, especially triple A titles, has gone down in the past 10-15 years, and you can sit here and give Starfield: Yet Another Wide as an Ocean but Deep as a Puddle + Boring Experience from Bethesda ™️ is a 7/10; I don't think you really have the right to complain about the declining quality of video games when you're essentially contributing to it by claiming incredibly mediocre games are above average.

    If you feel good that you paid $70-100 for what's really feels like a $40 barely out of early-access game, hey, I can't change your mind.

    -2
  • greentext > Greentext Anon is disillusioned about Starfield
    Jump
    greentext > Greentext Anon is disillusioned about Starfield
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    12 months ago 18%

    Plenty of people have enjoyed this game and found things to like even if it's not perfect.

    "People enjoy the slop so the slop must not be that bad."

    but you can't dictate to other people that they also shouldn't enjoy it.

    Yes but we can absolutely point out they're enjoying slop and are probably the biggest contribution to mainstream games becoming more and more soulless slop.

    -7
  • selfhosted Selfhosted Introducing Raspberry Pi 5
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    12 months ago 100%

    Currently, and I could be wrong, the alternative to a Pi 4 from Pine64 now would be a Pine64's Quartz64 Model B. A Star64 might be interesting, but that's RISC-V so who knows what OS you could boot on it currently and if it would even be stable.

    Plus with the Quartz64 Model B, who knows if you'll able to get a good case for it. There's the $28 “Model B” ALUMINUM WATERPROOF ENCLOSURE, but, eh, no thanks. There's the open enclosure, but that's also a no for me. I want a case I can hide the device itself, the cables, put a heatsink and fan on, be able to use an SSD with USB connect and connect a power supply all stuffed in a case. Which you can find plenty of for Raspberry Pi's.

    Not to mention the Pi 5 isn't even out yet, and it's entirely possible it'll be better than the Quartz64 Model B, on top of having a ton of accessories. Plus, I can Pi up practically any Pi at the Microcenter or similar store near me as opposed to having to pay for good shipping.

    I'm totally for having alternatives to the Pi, heck I might pick up a Quartz64 Model B if I can find a case, but a lot of alternatives don't have the same support and accessories the Pis do.

    2
  • selfhosted Selfhosted Do any of you use Raspberry Pi’s ?
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    12 months ago 100%

    I got a RPi 3B as my Pi-Hole that I'll eventually use as my Wireguard VPN, too. Hoping to get another Pi device for hosting Jellyfin on.

    2
  • selfhosted Selfhosted *Permanently Deleted*
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    12 months ago 100%

    Outside of the (theoretical) technical specs of the OPi5 being better, I've heard/read mixed things about OPis. Some say they're a good alternative, some say they're cheap Chinese-made crap. I've had no experience myself, so take it with a grain of salt.

    I'm interested to see more data on the RPi5 when it's out, as to figure out if it's worth getting over trying an OPi5 for a home media system with Jellyfin.

    6
  • selfhosted Selfhosted Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    Tailscale just partnered with Mullvad so this works out of the box for that setup: https://tailscale.com/blog/mullvad-integration/

    Ah I literally saw that post here a few days ago! How could I forget about that? I might just switch over to Mullvad. Way cheaper, I can downgrade the Proton account I have (I'll still use their email service until I have time and figure out how to self-host my own email) and I can use Mullvads encrypted DNS servers until I can configure DNS-over-HTTPS + Unbound on my PiHole.

    2
  • houseplants Houseplants Sanguinea Orange happy in the summer humidity
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    It's a nepenthes Diana.

    Ah yes! That's a great little hybrid. This plant, no?

    It was winter and I assumed it would drop all it's pitchers and go dormant. However its leaves are also a bit brown.

    In cooler times in nature they don't go dormant, they just make less pitchers.

    Here's my suggestions

    • Let the medium get almost dry between waterings

    When it does, fill up the tray and let the water be absorbed or evaporated.

    • Move it to an east facing window, or outside during spring

    Maybe it needs more light. New Zealand has a fairly tropical climate IIRC so outdoors in the spring might be a great idea. Here's an interesting read about light.

    • If you tap water has a PPM above 50, repot

    I don't think you'll have to do this as looking at your governments legislation the water is a lot better than some parts of America.

    Here's another guide to repotting from a reputable grower. They even have suggestions of when to repot.

    Other than that Nepenthes 'Diana' is a pretty vigorous and hardy hybrid.

    3
  • selfhosted Selfhosted Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    Force tailscale to route all traffic through the DERP servers?

    No no, sorry. I mean can I still have all my network traffic go through some VPN service (mine or a providers) while Tailscale is activated?

    So if I'm torrenting something, I don't have to turn off Tailscale on that device and switch on a VPN before I start the torrent process?

    I'm going to guess either "no" or "yes, on paper, it's possible."

    1
  • houseplants Houseplants Sanguinea Orange happy in the summer humidity
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    If your plant looks similar to this or this then yea then that's an entirely different plant genus than nepenthes and it'll do fine wetter conditions. I would still like the water in the tray get soaked up before filling it again, just make sure the medium doesn't get dry.

    Are you growing this indoors or outdoors?

    Also, if it's winter then keep in mind sarracenia are perennial, meaning they go dormant starting in the mid-late fall and all through winter.

    1
  • selfhosted Selfhosted Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    your traffic is not routed through the Headscale server

    Damn, well is there a means of using both Headscale and routing your traffic somewhere else?

    My big reason for looking into Tailscale/Headscale is the ability to connect to my devices at home, at the office or a VPS that's in a different state/province and having the ability to use my PiHole as my DNS, but I would still like my network traffic to be (mostly, as an VPN doesn't save you from other tracking methods) protected.

    1
  • houseplants Houseplants Sanguinea Orange happy in the summer humidity
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    Bog plants are more like Sarracenia (American pitcher plants), some Drosera (sundews) and Dionaea muscipula (venus fly traps). They're plants that like more wet soils and don't want it to dry out, and, obviously, their native habitats are bogs.

    Nepenthes, or tropical pitcher plants, are tropical plants. Some species grow on the sides of cliff faces or more in the mountains of tropical areas. They like wet air more than wet soil.

    1
  • selfhosted Selfhosted Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    To a first approximation, Tailscale/Headscale don’t route and traffic.

    Ah, well damn. Is there a way to achieve this while using Tailscale as well, or is that even recommended?

    Are younreally expecting 10gb/s speeds over your encrypted links?

    Eh, no. You have a good point there. I mean in a more perfect world that would be wonderful, but that's not the case.

    1
  • selfhosted Selfhosted Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    but your traffic is not routed through their servers,

    Hmm so correct me if I'm wrong (I probably am), but with a basic Wireguard setup you'd have one device act as the server and other devices that connect to it are the clients. But can't you have 2 devices that act as servers/clients to each other, and then have other devices connect to them and the connect with bounce between those two devices?

    I'm assuming that if this is even achievable, it's not something Tailscale or Headscale will let you do.

    1
  • selfhosted Selfhosted Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    are you the only user or is this for some family members also?

    Probably just me and my fiance at the moment.

    you can 9/10 just get a basic 5$ or less gigabit VPS.

    Sweet, good to know!

    1
  • selfhosted Selfhosted Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    $20 per month for 400mb of email + a VPN was an acceptable cost maybe in 1998, now it’s insanely expensive

    Yea I have a business plan with Proton. No idea why I upgraded but I remember doing it.

    And then you need to tell us why you’re using the VPN. Just privacy when using unsecured wifi? Or ISP tracking paranoia? Or torrenting?

    Yes, yes and yes lol. Also I would like to connect to devices privacy and see if I can make use of my PiHole when I'm not on my home network where the PiHole is located.

    1
  • selfhosted Selfhosted Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    I have a business account with them. I don't really remember why I upgraded to a business plan. Might downgrade it to save a few bucks for now.

    2
  • selfhosted Selfhosted Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    If you are not trusting Proton, you should not trust Tailscale as well, in my opinion.

    True, although I don't know if I say I don't trust them. It's more of a sense of skepticism that's always in the back of my mind when it comes to any service.

    Another question is that why are you paying $19 for that? They have $10-12 plans that come with 500 GB storage, emails with 3 custom domains and high-speed VPN.

    I have a business account with them. I'm trying to remember why I upgraded...

    Another question that pops in my mind is, why do you need a VPN? Do you need to connect to your services privately, or do you just need to change your IP for (relatively) better privacy?

    At this point, if I'm going to do be doing more self-hosting I'd want the ability to connect to services privately. The other thing is that with Tailscale I can set my PiHole as my DNS server. That way any device on the tailnet gets the ad blocking as well. Plus, if I can get unbound with DNS-over-HTTPS (via stubby) setup on it then I have a pretty secure and fairly private setup. That's kind of what's got me thinking about moving to Tailscale.

    2
  • houseplants Houseplants Sanguinea Orange happy in the summer humidity
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    No they don't prefer sitting in water. From the RedLeaf Exotics site:

    Nepenthes like being kept moist, not wet. Think of a moist sponge. They appreciate a well draining potting mix and dislike standing in water constantly. They should never be allowed to completely dry out. You can keep them in saucers of water indoors, but they must be allowed to evaporate in between waterings.

    And from Carnivero:

    Nepenthes like to remain moist but not flooded. This is best accomplished by top watering them 2-3 times per week. The shallow tray method can be used when going out of town. Fill the tray with about 1” of water and then allow the tray to dry out for a couple days before refilling.

    Just to give you info from some professional and reputable nepenthes growers!

    1
  • selfhosted
    Selfhosted AlecStewart1st 1 year ago 92%
    Cost Benefit: Tailscale vs. Tailscale w/ Self-Hosted Headscale Instance vs. VPN Provider

    Hello friends! For awhile now I've wanted to delve into self-hosting and the first thing I thought of was ditching my VPN Provider for my own VPN solution. I wanted to ask about the cost/benefit of each option with those of you who are more experienced. ## Option One: Stick with my VPN Provider: This is a funky case, as my VPN Provider is with Proton, and my email and VPN accounts are linked together. Since I've been with them for awhile, I have over a gigabyte of storage for emails. I rarely ever get past 400MB. The VPN is fine, occasionally I have some hiccups with speed but it overall works. I pay roughly $19.20/month for both a paid email account and the VPN service, so it's likely the second cheapest. When it comes to privacy, though, I'm not 100% sold Proton wouldn't just sell my data for no reason. Yes, they are Swiss, but that doesn't entirely reassure me. The weird thing about this is my PiHole is decoupled from the VPN. At least in the mobile app, I see no option to use your own DNS. There's also no provided way nor really an obvious way for me to connect to all of my devices if they're all on ProtonVPN, as opposed to the other two options. ## Option Two: Just use Tailscale Personally I'd like to mess with the ACLs so probably I'd wind up with the $6/month plan. For the $18/month plan I don't really know what "Tailscale SSH" even means, as I don't know what magic they do to wrap SSH into something worth paying for. I've heard mixed things about "Tailscale Funnel." I hear Tailscale is easy to install and there's no real extra fidgeting you'd have to do for your home network. Tailscale will also let me use my PiHole as my DNS, getting me ad-blocking from PiHole on all devices on Tailscale. ## Option Three: Self-Hosted Headscale This is one I'm interested in, but I don't know the feasibility of it. The initial idea was to get a VPS and install OpenBSD on it and make it my Headscale instance. I've installed OpenBSD before, I mostly know my way around it and I like how lightweight it is and how security focused it is. There would be more setup initially, but I don't really mind that. I do a lot of fidgeting on my Linux desktop anyway. The main thing for this is cost. I don't really know what performance specs for a VPS I would need to reasonably have good network performance with ~10 devices, though I'm guessing I'll have to have something =&lt;10Gbsp. So maybe $25-$30/month depending on who I buy a VPS through? The other thing is updating stuff. I can just SSH and do all of that manually and since the VPS will be dedicated specifically to being a Headscale server, but that is still time I have to spend. Lastly, I wouldn't have the international selection of VPN locations like with a VPN provider, just one, but it's not like I'm trying to bounce my connection from country and that's not advisable anyway. ## Other options Setting up a VPS with Wireguard myself. While I wouldn't mind it too much, Tailscale exists for a reason and it can traverse firewalls without me having to configure a bunch of devices so that's a big plus. Running Headscale in a container on my Linux desktop, but this means my desktop would have to be on almost 24/7 and I don't know how I feel about having my VPN stuff to be sitting directly inside my home network. What are your opinions?

    36
    26
    houseplants Houseplants Sanguinea Orange happy in the summer humidity
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    It sits in water so it's always wet.

    I use tap water but it's from a well so It might be a bit overly mineral. I can try and deionize it.

    Ah well I'd start with the first thing. Nepenthes aren't bog plants, they don't like sitting in water. They like they're medium moist. So I'd dump the water out of the tray it's in and only pour water in the try when the medium starts feeling like it's about to dry out.

    2
  • houseplants Houseplants Sanguinea Orange happy in the summer humidity
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    There's a few things you might want to double check if your nepenthes is not looking peppy:

    • How often are you watering?

    Too much and it won't like that, too little and it won't like that either. Water when the medium starts to feel a little dry, like right before a sponge is dry.

    Also double check the PPM of your water. Nepenthes can tolerate some salts, but above 50 PPM is generally not recommended.

    • Did you repot it recently?

    Nepenthes especially don't like their roots being disturbed. I have a plant that I repotted waaay more than I should've that's still recovering a month or a little more later. Give it a month or two if you've reported it, and try giving it extra humidity as that helps the plant settle in when repotting.

    • How much light is it getting?

    An east facing window is usually what's recommended for nepenthes. Morning light followed by "dappled" light (like slightly shaded) is what most nepenthes like.

    1
  • linux_gaming Linux Gaming Running Starfield with Lutris and wine-ge: Your drivers are out of date?
    Jump
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearAL
    AlecStewart1st
    1 year ago 100%

    True! I should probably do that before delving too deep to where I start losing my sanity.

    EDIT: And ay, voila! It works! Played a little bit and so far I'm not too impressed by performance nor the game itself, but at least it works now.

    4
  • linux_gaming
    Linux Gaming AlecStewart1st 1 year ago 100%
    Running Starfield with Lutris and wine-ge: Your drivers are out of date?

    ## Intro Hello friends, I've been hearing mixed things about Starfield, so I thought I'd try experiencing it myself. Before you ask "why aren't you running Starfield with Steam's Proton Experimental or Proton-GE" let's say I went out sailing yesterday and met a fellow legitimate sailor who was giving many people a *great* discount on the game. Getting back to port, the sea was rough were quite a few torrents crashing against the cliff faces that evening. I've tried various various environment flags to get the game working, but nothing seems to work. I even made sure the installation of lutris-GE-Proton8-14 had the most up-to-date version of VKD3D. I checked the `winecfg` for that version of wine and it's has the correct Windows version and all of that. Manually running the game with the wine executable in that version of wine with the `WINEPREFIX` set to where that's install for Lutris gives me a few interesting lines. As of note, the game does, erm, "launch" in that it creates a new window for Starfield, but it's all black and stays that way. ## First interesting lines ``` 01b8:err:setupapi:create_dest_file failed to create L"C:\\windows\\system32\\d3d12.dll" (error=80) wine: configuration in L"/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64" has been updated. ``` Okay? But the configuration for wine shouldn't be updating, for one, and running the setup script provided by VKD3D-Proton gets me the following: ``` setup_vkd3d_proton.sh install --symlink wine: configuration in L"/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64" has been updated. wine: configuration in L"/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64" has been updated. removed '/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64/dosdevices/c:/windows/system32/d3d12.dll' '/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64/dosdevices/c:/windows/system32/d3d12.dll' -> '/usr/lib/vkd3d-proton/x64/d3d12.dll' removed '/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64/dosdevices/c:/windows/syswow64/d3d12.dll' '/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64/dosdevices/c:/windows/syswow64/d3d12.dll' -> '/usr/lib/vkd3d-proton/x86/d3d12.dll' removed '/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64/dosdevices/c:/windows/system32/d3d12core.dll' '/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64/dosdevices/c:/windows/system32/d3d12core.dll' -> '/usr/lib/vkd3d-proton/x64/d3d12core.dll' removed '/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64/dosdevices/c:/windows/syswow64/d3d12core.dll' '/home/alec/.local/share/lutris/runners/wine/lutris-GE-Proton8-14-x86_64/dosdevices/c:/windows/syswow64/d3d12core.dll' -> '/usr/lib/vkd3d-proton/x86/d3d12core.dll' ``` So I don't know why the wine configuration is being updated again. ## Next interesting lines ``` 163756.705:01d4:031c:fixme:vkd3d-proton:d3d12_command_signature_create: State template is required for compute, but VKD3D_CONFIG_FLAG_FORCE_COMPUTE_ROOT_PARAMETERS_PUSH_UBO is not enabled. 163756.711:01d4:0314:fixme:vkd3d-proton:d3d12_command_signature_create: State template is required for compute, but VKD3D_CONFIG_FLAG_FORCE_COMPUTE_ROOT_PARAMETERS_PUSH_UBO is not enabled. 163756.755:01d4:031c:fixme:vkd3d-proton:d3d12_command_signature_create: State template is required for compute, but VKD3D_CONFIG_FLAG_FORCE_COMPUTE_ROOT_PARAMETERS_PUSH_UBO is not enabled. 163756.758:01d4:030c:fixme:vkd3d-proton:d3d12_command_signature_create: State template is required for compute, but VKD3D_CONFIG_FLAG_FORCE_COMPUTE_ROOT_PARAMETERS_PUSH_UBO is not enabled. 163756.761:01d4:0334:fixme:vkd3d-proton:d3d12_command_signature_create: State template is required for compute, but VKD3D_CONFIG_FLAG_FORCE_COMPUTE_ROOT_PARAMETERS_PUSH_UBO is not enabled. 163756.762:01d4:0334:fixme:vkd3d-proton:d3d12_command_signature_create: State template is required for compute, but VKD3D_CONFIG_FLAG_FORCE_COMPUTE_ROOT_PARAMETERS_PUSH_UBO is not enabled. 163756.768:01d4:0344:fixme:vkd3d-proton:d3d12_command_signature_create: State template is required for compute, but VKD3D_CONFIG_FLAG_FORCE_COMPUTE_ROOT_PARAMETERS_PUSH_UBO is not enabled. 163756.769:01d4:0334:fixme:vkd3d-proton:d3d12_command_signature_create: State template is required for compute, but VKD3D_CONFIG_FLAG_FORCE_COMPUTE_ROOT_PARAMETERS_PUSH_UBO is not enabled. ``` I don't know what this means or if it's what would cause my issue, but since it repeated several times I'm assuming it's something worth noting. ## Final Thoughts and System Info I could just be having issues due to getting that discount from my fellow sailor, but I wouldn't know. I'm very skeptical, mainly because "Your drivers are out of date" is so specific. ### System Info I'm on Gentoo, a hardened profile on Linux Kernel 6.1.46. I'm currently on Mesa version `23.2.0_rc3`. I'm on the master/main branch for the `xf86-video-amdgpu` driver. If there's anything other system info I can provide that will help me fix this, let me know. ## EDIT Add it as a Non-Steam game in Steam and it'll work there with Proton-GE 8.14. Unfortunately, given this is a Bethesda game, your performance will vary likely until 2-3 patches later. I have the following launch options, some probably aren't necessary: ``` PROTON_LOG=1 DXVK_ASYNC=1 WINE_FULLSCREEN_FSR=1 WINE_FULLSCREEN_FSR_STRENGTH=1 gamemodeun %command% --skip-launcher ``` Stay safe, fellow Linux gamers and sailors. 🫡

    24
    6
    linux_gaming
    Linux Gaming AlecStewart1st 1 year ago 100%
    Suddenly having funny issues with framerates: Vulkan, Mesa or something else?

    Hey friends, I know that this is a difficult issue to have people try and solve due to how many factors there can be, but this is an odd one for me. To start, here's some info ``` === Hardware === CPU: 12th Gen Intel(R) Core(TM) i5-12600K GPU: AMD Radeon RX 6700 XT (navi22, LLVM 16.0.6, DRM 3.52, 6.4.8-gentoo-dist-hardened) Memory: DDR5 5200 Monitor Refresh Rate: 165.00 Hz === Software === Distro: Gentoo Kernel Version: 6.4.8-gentoo-dist-hardened Mesa Version: 23.1.5 Vulkan Version: 1.3.250 GCC Version: 13.2.0 xf86-video-amdgpu Version: Up-to-date with the master branch Display server: X.Org xorg-server version: 21.1.8 xorg-proto version: 2023.2 === Proton Info === Have tried GE-Proton versions 7.53 to 8.11 --- Games and their commonly used Steam Launch Options --- Enderal: Forgotten Stories (Special Edition), Steam App ID 976620 PROTON_LOG=1 PROTON_NO_ESYNC=1 DXVK_ASYNC=1 WINE_FULLSCREEN_FSR=1 WINE_FULLSCREEN_FSR_STRENGTH=1 WINEDLLOVERRIDES="xaudio2_7=n,b" PULSE_LATENCY_MSEC=90 =1 LD_PRELOAD="$LD_PRELOAD:/usr/\$LIB/libgamemode.so.0.0.0" gamemoderun %command% I've also tried without DXVK_ASYNC and adding PROTON_USE_WINED3D=1 Deep Rock Galatic, Steam App ID 548430 No extra launch options. Runs on Linux, but still the weird framerate issues ``` This issue with low framerates only started happening recently. The earliest I recall seeing these issues was sometime 2 weeks ago. I thought it was something related to the version of GE-Proton I was using. Last time I had a problem was with using the stable version of Mesa but that was several months ago, about 9-10 months. When I run `glxgears` I get around 165-170 fps, so I don't think the physical GPU is the issue. Lower-end graphical games run perfectly fine. Nothing else has been running any slower, and I don't think I've made any notable changes to my system that would cause this. Running `btop` when nothing is running doesn't show any processes that's taking resources it shouldn't. Neither the GPU nor CPU make more noticeable noise or anything, nor does the CPU run hotter when I first got it and started playing games. Without doing getting really into the weeds, my best guest is something with versions of Mesa or Vulkan. But I wouldn't exactly know. I'm just basing that on the one issue that I had with an older version of Mesa those 9-10 months ago, so I could be completely wrong. I could try with the git versions of each package. I'll see if I can install those and see if anything is better and report back.

    22
    3
    selfhosted
    Selfhosted AlecStewart1st 1 year ago 91%
    Tips for asking ISP to allow for using my own DNS setup for self-hosted VPN?

    Hello, friends. So I've had my Pi-Hole setup for awhile now and it's great. I'd like to get Wireguard working with it, too, so I could browse the internet without loads of ads and trackers on the go. However, small issue. All DNS traffic is forcibly routed to my ISP. If you need some details, I made [this post on the Pi-Hole userspace.](https://discourse.pi-hole.net/t/unbound-not-working-even-with-extra-steps/60117/1) I'm in America and my ISP is Spectrum. I was wondering if there's a way I could convince technical support to allow me to use a recursive DNS for privacy/security (more-so the second of the two) purposes, or if it is even possible to convince them to do this. I don't know if there's a specific number I should contact, email I should email to, or if I just have to endure the nightmare of getting passed around by customer service one Saturday. Any recommendations would be great. An interesting note for anyone who's ISP is Spectrum, their DNS service, at least for me, uses OpenDNS with `dnsmasq-2.57`. That version of dnsmasq is over 10 years old. You see if this is the case for you with ``` dig CHAOS TXT version.bind @192.33.4.12 +short dig CHAOS TXT version.bind @198.97.190.53 +short ``` Or something similar if those IP addresses are different for you. You can see that running those commands were a part of the steps I was asked to take in that Pi-Hole userspace post. **EDIT 1:** For those interested, [here's some Github gist](https://gist.github.com/Jiab77/1cdc2896f22791c4db492e87bbf609ff) I found that shows how to use unbound + stubby for have a recursive DNS + DNS-over-HTTPS. There's also [this](https://dnsprivacy.org/dns_privacy_clients/#unboundstubby-combination) from the DNS Privacy Project. **EDIT 2:** I seems that initial answer from the Pi-Hole forums was correct. There's probably something that was set in the firmware for the Netgear router that prevents me from setting up my own DNS servers. However, I notice on the router there's a "router mode" option that's on, which I can probably turn off, plug in my Pi to the Netgear device and have the Pi act as my router, thus letting me be able to use it as my DNS server as well. That or just suck it up and buy only a modem, not a router + modem combo.

    28
    51
    emacs
    Emacs AlecStewart1st 1 year ago 100%
    [Help] Fixing homemade snippet system (Skeletons + Abbrevs

    Hey gang, So initially I had something pretty simple to have "snippets" in my Emacs config, using Skeletons and Abbrevs. I've expanded on it a little bit since then, but I'm running into an issue where the abbrev no longer expands to call the skeleton function. Here's what I have: ```emacs-lisp ;;;###autoload (defun abbrev::abbrev-table-add-props (abbrev-table props) "Add one or more PROPS to an existing ABBREV-TABLE. PROPS should be a plist of (PROP VALUE). Example: (:enable-function (lambda (&rest _) (do-something)))" (if (cddr props) (cl-loop for (k v) on props by #'cddr unless (not (abbrev-table-p abbrev-table)) unless (abbrev-table-get abbrev-table k) do (abbrev-table-put abbrev-table k v)) (unless (and (not (abbrev-table-p abbrev-table)) (abbrev-table-get abbrev-table (car props))) (abbrev-table-put abbrev-table (car props) (cadr props))))) ;;;###autoload (defmacro def-mode-snippet (name mode docstring &rest prompt-and-or-skeleton) "Create a MODES specific \"snippet\" with NAME and SKELETON. NAME must be valid in the Emacs Lisp naming convention. MODE must be a valid major or minor mode that is known to Emacs. Example: ‘org-mode’, ‘emacs-lisp-mode’, etc. DOCSTRING is used in the abbrev rather than the skeleton. PROMPT-AND-OR-SKELETON can be any of the following: 1. A valid Skeleton that uses the internal `Skeleton' langauge 2. A key/value \"pair\" that’s :prompt STRING, followed by a valid Skeleton that uses the internal `Skeleton' language. The prompt given is used by the Skeleton to prompt the user for an input. This macro makes use of `define-skeleton' and `define-abbrev' in order to create something similar to a code/writing snippet system, like that of `YASnippet'. Keep in mind that all abbreviations created are put in the abbrev table of MODE you passed to this macro. Example: passing ‘org-mode’ will add the abbrev to the ‘org-mode-abbrev-table’. That may or may not be something you want depending on your uses. If you're looking to only define an abbrev globally, see `def-global-snippet'." (declare (debug t) (doc-string 3) (indent defun)) ;; TODO need to figure out how to work with lists better (let* ((snip-name (symbol-name `,name)) (func-name (intern (concat (symbol-name mode) "-" snip-name "-skel"))) (var-str (concat (symbol-name mode) "-abbrev-table")) (abbrev-table (intern-soft var-str)) (has-prompt (keywordp (car prompt-and-or-skeleton))) (prompt (if has-prompt (cadr prompt-and-or-skeleton) nil)) (skeleton (if (not has-prompt) prompt-and-or-skeleton (cddr prompt-and-or-skeleton))) ;; Not using this for now until the issue with abbrevs not expanding is solved. ;;(enable-fn (lambda (&rest _) (or (eq major-mode 'mode) (numberp (cl-position 'mode minor-mode-list))))) ) (macroexp-progn `((define-skeleton ,func-name ,(format "%s %s %s %s." snip-name "skeleton. Defined in" var-str "abbreviaton table") ,prompt ,@skeleton) ,(if (not (abbrev-table-p abbrev-table)) `(define-abbrev ,abbrev-table ,snip-name ',func-name) `(define-abbrev-table ',abbrev-table '((,snip-name ',func-name)) ,(format "An abbrev table for %s" mode) :system t :case-fixed t) (abbrev::abbrev-table-add-props ,abbrev-table '(:system t :case-fixed t))))))) ``` The example I can give is the following: ```emacs-lisp (def-mode-snippet defun emacs-lisp-mode "defun snippet for Emacs Lisp" > "(defun " @ - " (" @ _ ")" \n > -2 "\"" @ _ "\"" \n > -1 @ _ ")") ``` And that will macro-expand to: ```emacs-lisp (progn (define-skeleton emacs-lisp-mode-defun-skel "defun skeleton. Defined in emacs-lisp-mode-abbrev-table abbreviaton table." nil > "(defun " @ - " (" @ _ ")" n > -2 "\"" @ _ "\"" n > -1 @ _ ")") (define-abbrev emacs-lisp-mode-abbrev-table "defun" 'emacs-lisp-mode-defun-skel)) ``` Which evals fine, even though I think the `n` would not be valid to Skeleton, but I'm not sure. **EDIT 1:** I've put up a [question on The Emacs StackExchange](https://emacs.stackexchange.com/questions/78083/abbrevs-with-skeletons-no-longer-expanding) with more details if anyone is interested. Also, if it helps looking at my full config you can view it [here](https://codeberg.org/alecStewart1/dots/src/branch/main/emacs/.emacs.d). **EDIT 2:** Good god, I nearly lost my mind by missing this: ``` (define-abbrev emacs-lisp-mode-abbrev-table "defun" 'emacs-lisp-mode-defun-skel) ``` When defining an abbrev using a skeleton, the skeleton function should go in an `define-abbrev`'s hook argument. As the documentation for `define-abbrev` says: >If HOOK is a non-nil symbol with a non-nil no-self-insert property, it can control whether the character that triggered abbrev expansion is inserted. If such a HOOK returns non-nil, the character is not inserted. If such a HOOK returns nil, then so does abbrev-insert (and expand-abbrev), as if no abbrev expansion had taken place.

    5
    3