#+TITLE: Ypot's #+NICK: Ypot #+AVATAR: https://github.com/Ypot.png #+LINK: https://github.com/Ypot/ #+FOLLOW: Omar https://www.matem.unam.mx/~omar/social.org #+FOLLOW: Andros https://host.org-social.org/andros/social.org * Posts ** 2026-06-27T00:15:51+0200 :PROPERTIES: :CLIENT: org-social.el :LANG: en :TAGS: emacs calc calc-embedded emacs-carnival :END: *** How to read this post - You could open it in Emacs (interactive): =M-x eww RET https://raw.githubusercontent.com/Ypot/social/refs/heads/main/org-social.org=. Optionally, you can do =M-x org-mode= (strongly recommended). - Want to read this in Org Social? You can follow me: =#+FOLLOW: Ypot https://ypot.github.io/social/org-social.org=, and activate org-mode: =M-x org-mode= when reading the post (strongly recommended). - Just want it rendered in a browser? https://github.com/Ypot/social/blob/main/org-social.org (not interactive, not recommended). *** Intro *Calc Embedded* operates inside any ordinary buffer. There is no calc buffer in sight, there is no major, nor minor mode: *Each formula is its own little calculator.* If you are reading this in an Emacs buffer, try it without leaving this spot: put point on the formula between =$= signs and press =C-x * u=: $80 km/h * 2h$ Maybe you will need this first: #+begin_src emacs-lisp (setq calc-multiplication-has-precedence nil) #+end_src Try again: $80 km/h * 2h$ *** Evaluates-to formulas Add ~=>~ and it evaluates-to the right side, keeping both sides. Either way the units ride along and cancel where they can. Put point again on the formula between =$= signs and press =C-x * u=: $(1000 kg/m^3) * (2 m^3) => $ *** Assignment formulas Add ~:=~ and it assigns a value to a variable that the rest of the buffer can reuse. =M-1 C-x * a= detects and re-activates every "assignment-formula" in the buffer (the =M-1= forces a clean rebuild). Then, you just have to put the point on the last "evaluates-to formula" and press =C-x * u=: $rate := 45 EUR/h$ $hours := 32 h$ $rate * hours => $ *** Units Units handling is brilliant in Calc, and we can leverage it in Calc Embedded: $leg1 := 3 m$ $leg2 := 40 cm$ $hyp := sqrt(leg1^2 + leg2^2) => $ The bare version keeps =m= and =cm= apart — it returns =sqrt(9 m^2 + 1600 cm^2)=, unconverted. Wrap it in =usimplify= and Calc reconciles the scales into one clean length: $hyp := usimplify(sqrt(leg1^2 + leg2^2)) => $ $mass := 2 kg$ $v := 3 m/s$ $E_c := (1/2) mass * v^2 => $ Out comes =9 kg m^2 / s^2= *** Equations It can also solve equations! Press =C-x * u= on the next formula: $solve(22 x + 33 = 65, x) => $ *** Batch With several formulas at once you do not poke them one by one; =M-1 C-x * u= should compute them all [fn:1893e64a74b69123]. $rate := 45 EUR/h$ $hours := 32 h$ $material := 180 EUR$ $rate * hours => $ $subtotal := rate * hours + material => $ Total w/VAT: $subtotal * 1.21 => $ *** Finale: make it big Embedded mode can also draw formulas in two dimensions — stacked fractions, raised exponents, roots — with the Big language. A global-mode line sets the display for the whole buffer; Calc scans for it from the top of the buffer, so where you place it does not matter: [calc-global-mode: language: nil] Change that =nil= to =big=, re-scan with =C-x * a=, then recompute with =M-1 C-x * u=: every formula in the post redraws stacked. A 2-D formula spans several lines, so it will break. *** Bonus: base conversion [calc-mode: radix: 2] 16#A3 [calc-mode: radix: 6] 16#A3 [calc-mode: radix: 10] 16#A3 *** Footnotes [fn:1893e64a74b69123] Thanks to Eli Zaretskii for solving it for Emacs 31 ([[https://debbugs.gnu.org/cgi/bugreport.cgi?bug=80901][Emacs bug#80901]]). On Emacs 30.x and earlier you may need this workaround: #+begin_src emacs-lisp (defun calc-embedded-update-all-formulas () "Update all Calc embedded formulas in the current buffer. Processes in dependency order: := assignments, then => evaluations, then bare expressions (variable references like $var$). Workaround for a bug where the prefix-arg path of `calc-embedded-update-formula' silently drops formulas during cascade recomputation (Emacs bug#80901)." (interactive) (let (assignments evaltos expressions (count 0)) (save-excursion (goto-char (point-min)) (while (re-search-forward "\\$\\([^$\n]+\\)\\$" nil t) (let ((text (match-string 1)) (pos (copy-marker (1+ (match-beginning 0))))) (cond ((and (string-match ":=" text) (not (string-match "=>" text))) (push pos assignments)) ((string-match "=>" text) (push pos evaltos)) (t (push pos expressions)))))) (setq assignments (nreverse assignments) evaltos (nreverse evaltos) expressions (nreverse expressions)) (save-excursion (dolist (pos (append assignments evaltos expressions)) (goto-char pos) (condition-case nil (progn (calc-embedded-update-formula nil) (cl-incf count)) (error nil)) (set-marker pos nil))) (message "Updated %d formulas" count))) (advice-add 'calc-embedded-update-formula :around (lambda (orig arg) "Redirect prefix-arg path to the workaround for bug#80901." (if arg (calc-embedded-update-all-formulas) (funcall orig arg)))) #+end_src ** 2026-07-07T21:09:51+0200 :PROPERTIES: :ID: 2026-07-07T21:10:29+0200 :LANG: en :CLIENT: org-social.el :TAGS: pmp projectmanagement android beta :MOOD: 🛠️ :END: Been building a little tycoon game on the side (you run a project company, take on jobs, and try to keep the budget and the deadlines under control). Built for the 2026 PMP exam if you're chasing the cert; just an attempt at a fun sim if you're not. Why it might be your kind of thing: - *A real management sim* — not a quiz wearing a game costume. - *No ads, no tracking, no phone-home.* Your data never leaves the device. - One-person, nights-and-weekends project. It's in a closed beta on Google Play. If you are willing to try it for a couple of weeks (Google's beta rules) you'd really help me out — and as a thank-you, everyone who tests during the beta keeps the full version free, for good. To try it: first join the group: https://groups.google.com/g/pm-tycoon-testers Then install: https://play.google.com/store/apps/details?id=app.pmtycoon One Google account, start to finish. The beta is tied to the Google account your phone uses for the Play Store (check it: Play Store → your profile picture). Join the group and install with that same account. If the group opens the wrong account (common with several accounts), open the link in a private/incognito window and sign in with the right one — clean session, no mix-ups. Still stuck? Email me and I'll add you directly.