Hello I’m having some troubles fixing the next error.

Error (use-package): aas/:config: Condition must be either nil or a function

the source of code is:

(use-package aas
  :hook (LaTeX-mode . aas-activate-for-major-mode)
  :hook (org-mode . aas-activate-for-major-mode)
  :config
  (aas-set-snippets 'org-mode

    ;; set condition!
    :cond #'texmathp ; expand only while in math

   "fr" '(yas "\\frac{$1}{$2}$0") 
   "lr(" '(yas "\\left( $1 \\right)$0") 
   "lr[" '(yas "\\left[ $1 \\right]$0")
   "lr{" '(yas "\\left\\\\{ $1 \\right\\\\}$0")
   "lr|" '(yas "\\left| $1 \\right|$0")
   "lr<" '(yas "\\left\\langle $1 \\right\\rangle$0")
   "sqr" '(yas "\\sqrt{$1}$0")
   "cbr" '(yas "\\sqrt[3]{$1}$0")
   "nthr" '(yas "\\sqrt[$1]{$2}$0")
   "dint" '(yas "\\int_{$1}^{$2}{$3 d$4}$0")
   "int" '(yas "\\int{$1 d$2}$0")
   "lim" '(yas "\\lim_{$1 \\to $2}{$3}$0")
   "neq" '(yas "\\neq $0")
   "geq" '(yas "\\geq $0")
   "leq" '(yas "\\leq $0")
   "sim" '(yas "\\sim $0")
   "->"  '(yas "\\to $0")
   "=>"  '(yas "\\implies $0")
   "inn" '(yas "\\in $0")
   "set" '(yas "\\\\{$1 \\\\}$0")
   "cc"  '(yas "\\subset $0")
   "EE"   '(yas "\\exists $0")
   "nEE"  '(yas "\\nexists $0")
   "VV"   '(yas "\\forall $0")
   "xx"   '(yas "\\times $0")
   "..."  '(yas "\\dots $0")
   ";."   '(yas "\\vdots $0")
   ";/"   '(yas "\\ddots $0")

   
    )

(aas-set-snippets 'org-mode

    "mk" '(yas "$$0$") 
    "md" '(yas "$$ $0 $$")
))

I think the problem is in the line :cond #'texmathp.

Thanks in advance!

  • arthurno1B
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    cdlatex is not need it.

    The manual says you have to install it:

    You need to install ‘cdlatex.el’ and ‘texmathp.el’ (the latter comes also with AUCTeX) from NonGNU ELPA with the Emacs packaging system or alternatively from https://staff.fnwi.uva.nl/c.dominik/Tools/cdlatex/.

    The manual I linked you to.

    Your stack trace confirms: you don’t have cdlatex installed (or not in your path) when you are trying to turn on cdlatex mode with turn-on-org-cdlatex.

    If that is the best user experience or not I leave to the interested party to lift in a bugreport/request to org devs, but it is what it is, and is documented in the manual.