• use-package configuration for calc not run at startup

    From Loris Bennett@loris.bennett@fu-berlin.de to gnu.emacs.help on Tue Aug 8 11:47:45 2023
    From Newsgroup: gnu.emacs.help

    Hi,

    In my initialisation for Emacs I have:

    (use-package calc
    :demand t
    :custom
    (math-additional-units
    '((bits nil "bits")
    (B "8 * bits" "Bytes")

    ;; Decimal units
    (kB "1000 B" "kilobyte")
    (MB "1000^2 B" "megabyte")
    (GB "1000^3 B" "gigabyte")
    (TB "1000^4 B" "terabyte")
    (PB "1000^5 B" "petabyte")
    (EB "1000^6 B" "exabyte")
    (ZB "1000^7 B" "zettabyte")
    (YB "1000^8 B" "yottabyte")

    ;; Binary units
    (KiB "1024 B" "kibibyte")
    (MiB "1024^2 B" "mebibyte")
    (GiB "1024^3 B" "gibibyte")
    (TiB "1024^4 B" "tebibyte")
    (PiB "1024^5 B" "pebibyte")
    (EiB "1024^6 B" "exbibyte")
    (ZiB "1024^7 B" "zebibyte")
    (YiB "1024^8 B" "yobibyte")))
    :config
    (setq math-units-table nil))

    However, this seems never to be run when Emacs is started, as calc is
    unaware of units thus defined. However, the code before and after the
    calc configuration is run. If I then go to the initialisation file and explicitly eval the above code, everything works as expected.

    Can anyone see what I am doing wrong?

    Cheers,

    Loris
    --
    This signature is currently under constuction.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Garjola Dindi@garjola@garjola.net to gnu.emacs.help on Fri Sep 15 19:30:32 2023
    From Newsgroup: gnu.emacs.help


    Hi,

    Would replacing :custom by :init work?
    --
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Loris Bennett@loris.bennett@fu-berlin.de to gnu.emacs.help on Wed Jan 3 09:25:48 2024
    From Newsgroup: gnu.emacs.help

    Garjola Dindi <garjola@garjola.net> writes:

    Hi,

    Would replacing :custom by :init work?

    The replacement on its own didn't work, but the following did:

    (use-package calc
    :defines (math-additional-units math-units-table)
    :init
    (setq math-additional-units
    '((bits nil "bits")
    (B "8 * bits" "Bytes")

    ;; Decimal units
    (kB "1000 B" "kilobyte")
    (MB "1000^2 B" "megabyte")
    (GB "1000^3 B" "gigabyte")
    (TB "1000^4 B" "terabyte")
    (PB "1000^5 B" "petabyte")
    (EB "1000^6 B" "exabyte")
    (ZB "1000^7 B" "zettabyte")
    (YB "1000^8 B" "yottabyte")

    ;; Binary units
    (KiB "1024 B" "kibibyte")
    (MiB "1024^2 B" "mebibyte")
    (GiB "1024^3 B" "gibibyte")
    (TiB "1024^4 B" "tebibyte")
    (PiB "1024^5 B" "pebibyte")
    (EiB "1024^6 B" "exbibyte")
    (ZiB "1024^7 B" "zebibyte")
    (YiB "1024^8 B" "yobibyte")))
    (setq math-units-table nil))

    The main issue seems to have been that the 'setq' in front of 'math-additional-units' was missing in my original configuration.

    Cheers,

    Loris
    --
    This signature is currently under constuction.
    --- Synchronet 3.21d-Linux NewsLink 1.2