0

I have

(setq TeX-auto-local "subdir")
(setq TeX-macro-private '("dir/"))

I want to set TeX-auto-private to dir/subdir by joining TeX-auto-local and TeX-macro-private together. I thought it was easy but I can't find a way.

Drew
  • 75,699
  • 9
  • 109
  • 225
Arch Stanton
  • 1,525
  • 9
  • 22

1 Answers1

1

For the stated examples, simply concatenating the two strings can be done like so:

(setq TeX-auto-private (concat (car TeX-macro-private)
                               TeX-auto-local))
=> "dir/subdir"

However it looks to me as if TeX-auto-private also needs to be a list, rather than a string?

TeX-auto-private is a variable defined in ‘tex.el’.
Its value is ("/tmp/emacs-sandbox.ollfrTriav/HOME/.emacs.d/auctex/auto")

Documentation:
List of directories containing automatically generated AUCTeX style files.

These correspond to the personal TeX macros.

So perhaps you actually want this?

(push (concat (car TeX-macro-private) TeX-auto-local)
      TeX-auto-private)

Or, if you wish to clobber any existing list elements:

(setq TeX-auto-private (list (concat (car TeX-macro-private)
                                     TeX-auto-local)))
phils
  • 48,657
  • 3
  • 76
  • 115
  • I don't understand your questions, excuse my ignorance. What do you mean with "initial values", the value the variable had before I set it? And regarding the second variable, I forgot where I first saw it set as a list element, but since it is where AUCTeX looks for private `.sty` files, it makes sense that it is a list that may be expanded – Arch Stanton Sep 05 '17 at 14:05
  • Never mind. I was a bit confused as to why one of the values was a list in the first place, but I've taken a look at tex.el now and can that it's expected to be so. However it looks like `TeX-auto-private` should also be a list, so I'll update the answer... – phils Sep 05 '17 at 22:23
  • I've found easier things in Emacs than setting up AUCTeX... I've tried your piece of code with `push` and I get an error: `concat: Symbol's value as variable is void: TeX-macro-private` [edit]: that's the error I got by evaluating the code in `Emacs -Q`. If I put the code in my `init.el` I get `Symbol's value as variable is void: TeX-auto-private` – Arch Stanton Sep 06 '17 at 08:37
  • If I put the code inside `(with-eval-after-load "latex" ...)` it doesn't give errors, but it does not load the auxiliary files, too. – Arch Stanton Sep 06 '17 at 09:21
  • ...which is ideal, yes? – phils Sep 06 '17 at 10:38
  • Nope. I can't quite understand what's happening here. `TeX-auto-private` contains the path AUCTeX searches for auxiliary files that, basically, I use for the autocompletion of my LaTeX macros. When I set `TeX-auto-private` within `(with-eval-after-load ...)`, `C-h v TeX-auto-private` shows that the variable contains the right path, but in practice I doesn't autocomplete my commands. Anyhow, I appreciated your help. With your solution AUCTeX works just right, even if it isn't optimal, perhaps. – Arch Stanton Sep 06 '17 at 10:53
  • You could try using `"tex"` (being the specific library which defines those vars) rather than `"latex"`. You could alternatively try forcibly loading the libraries with `require` before setting those variables, instead of using the deferred configuration (the latter would *usually* be preferable, but I don't know what the other issue is caused by, so this would be worth testing at least). – phils Sep 06 '17 at 11:52
  • 1
    I think the issue is related with `TeX-style-path`, see [AUCTeX isn't loading local per-package style files, is ignoring `TeX-auto-local`](https://emacs.stackexchange.com/questions/22657/auctex-isnt-loading-local-per-package-style-files-is-ignoring-tex-auto-local) – Arch Stanton Sep 06 '17 at 13:07