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!

  • liesdestroyer@alien.topOPB
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 months ago

    cdlatex is not need it.

    the message produces when I open my config.org

    here’s what the backtracer said

    Debugger entered--Lisp error: (file-missing "Cannot open load file" "No existe el fichero o el directorio" "cdlatex")
      org-cdlatex-mode(1)
      turn-on-org-cdlatex()
      run-hooks(change-major-mode-after-body-hook text-mode-hook outline-mode-hook org-mode-hook)
      apply(run-hooks (change-major-mode-after-body-hook text-mode-hook outline-mode-hook org-mode-hook))
      run-mode-hooks(org-mode-hook)
      org-mode()
      set-auto-mode-0(org-mode nil)
      set-auto-mode--apply-alist((("\\.hsc\\'" . haskell-mode) ("\\.l[gh]s\\'" . haskell-literate-mode) ("\\.hsig\\'" . haskell-mode) ("\\.[gh]s\\'" . haskell-mode) ("\\.cabal\\'\\|/cabal\\.project\\|/\\.cabal/config\\'" . haskell-cabal-mode) ("\\.chs\\'" . haskell-c2hs-mode) ("\\.ghci\\'" . ghci-script-mode) ("\\.dump-simpl\\'" . ghc-core-mode) ("\\.hcr\\'" . ghc-core-mode) ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . elisp-byte-code-mode) ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|jbuilder\\|rabl\\|ge..." . ruby-mode) ("\\.re?st\\'" . rst-mode) ("\\.py[iw]?\\'" . python-mode) ("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode) ("\\.scss\\'" . scss-mode) ("\\.cs\\'" . csharp-mode) ("\\.awk\\'" . awk-mode) ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode) ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode) ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode) ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode) ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode) ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode) ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode) ("\\.\\(cc\\|hh\\)\\'" . c++-mode) ("\\.\\(bat\\|cmd\\)\\'" . bat-mode) ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . mhtml-mode) ("\\.svgz?\\'" . image-mode) ("\\.svgz?\\'" . xml-mode) ("\\.x[bp]m\\'" . image-mode) ("\\.x[bp]m\\'" . c-mode) ("\\.p[bpgn]m\\'" . image-mode) ("\\.tiff?\\'" . image-mode) ("\\.gif\\'" . image-mode) ...) nil nil)
      set-auto-mode()
      normal-mode(t)
      after-find-file(nil t)
      find-file-noselect-1(# "~/.emacs.d/config.org" nil nil "~/.emacs.d/config.org" (7752901 2049))
      find-file-noselect("~/.emacs.d/config.org" nil nil nil)
      find-file("~/.emacs.d/config.org")
      (lambda nil (interactive) (find-file "~/.emacs.d/config.org"))()
      funcall-interactively((lambda nil (interactive) (find-file "~/.emacs.d/config.org")))
      command-execute((lambda nil (interactive) (find-file "~/.emacs.d/config.org")))
    
    • arthurno1@alien.topB
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 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.