this post was submitted on 30 Nov 2023
1 points (100.0% liked)

Emacs

305 readers
3 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

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!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 9 months 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.