AblatedSprocket,
@AblatedSprocket@emacs.ch avatar

I'm hoping some of you more seasoned #emacs veterans can help me with something. I have an #elisp script that creates a plist, but a lot of the values are calculated based on other property values so I've ended up with a ton of (setq my-plist (plist-put my-plist :key (+ (plist-get my-plist :key2) calc-val))) expressions all over the place which seems a bit... unwieldy. Is there a better structure to use for this kind of scenario or is there a better way to go about this? Also I don't know how to do code snippets here, my apologies.

mykhaylo,
@mykhaylo@fosstodon.org avatar

@AblatedSprocket abstract the update into a separate function

AblatedSprocket,
@AblatedSprocket@emacs.ch avatar

@mykhaylo I'm glad you suggested this because I commonly abstract logic away only to stumble upon a function some time later that does what I want. Especially with Org mode.

In every other language I've used, the built-in APIs for updating a data structure are much more concise. Since it's such a common thing to do, I figured I had to be missing something. I think fset is what I'm missing.

mykhaylo,
@mykhaylo@fosstodon.org avatar

@AblatedSprocket there are very cool libraries to work with hash-maps, that make it almsot as convenient as clojure. Also for general programming. So, for hash maps try:

https://github.com/Wilfred/ht.el

And for general programming:

https://github.com/magnars/dash.el

  • All
  • Subscribed
  • Moderated
  • Favorites
  • emacs
  • DreamBathrooms
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • InstantRegret
  • tacticalgear
  • anitta
  • ethstaker
  • provamag3
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • modclub
  • megavids
  • normalnudes
  • Leos
  • JUstTest
  • lostlight
  • All magazines