Open Beakcraft opened 1 week ago
well. now i am struggling having following init.el file give me my desired results (namely C-c C-c resulting in a displayed and updated pdf in pdf-tools) (use-package auctex :ensure t :defer t :hook (Latex-mode . (lambda () (push (list 'output-pdf "PDF Tools") Tex-view-program-selection))))
(use-package pdf-tools :ensure t :config (pdf-tools-install))
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))) (setq TeX-source-correlate-start-server t)
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
Issues to Compile epdf server over/with emacs Trying to compile i get/got following error: synctex_parser.c: In function '_synctex_updater_print_gz': synctex_parser.c:8448:13: error: implicit declaration of function 'vasprintf'; did you mean 'vsprintf'? [-Wimplicit-function-declaration] 8448 | if (vasprintf(&buffer, format, va) < 0) { | ^
~~~~ | vsprintf make[1]: [Makefile:484: libsynctex_a-synctex_parser.o] Error 1 make: [Makefile:346: all] Error 2Steps to Reproduce the behaviour Steps to reproduce the behaviour:
What is the expected behaviour? no idea what i m doing, but Build succeeded (which i got now, will explain later) as an output seems legit. And opening pdfs with emacs should use the pdf-tools thingy (mode PDFView)
Desktop Please complete the following information:
brew info poppler
and similarly for other OSs]-> sry no idea, but Poppler did throw a warning: epdfinfo.c: In function 'annotation_markup_append_text_region': epdfinfo.c:1576:5: warning: 'poppler_page_get_selection_region' is deprecated: Use poppler_page_get_selected_region instead [-Wdeprecated-declarations] 1576 | poppler_page_get_selection_region (page, 1.0, selection_style, region); | ^~~~~~~~~ In file included from C:/msys64/mingw64/include/poppler/glib/poppler.h:251, from epdfinfo.c:28: C:/msys64/mingw64/include/poppler/glib/poppler-page.h:75:8: note: declared here 75 | GList poppler_page_get_selection_region(PopplerPage page, gdouble scale, PopplerSelectionStyle style, PopplerRectangle *selection) G_GNUC_DEPRECATED_FOR(poppler_page_get_selected_region); | ^~~~~~~~~ C:\msys64\mingw64\bin\ar.exe:u' modifier ignored since
D' is the default (see `U') wasnt an issue so I ignored it.Your pdf-tools install Please complete the following information:
pdf-tools
Version: Status: Installed in ‘pdf-tools-1.1.0/’ (unsigned). Delete Version: 1.1.0 Commit: a9c9a12c3ecf2005fa641059368ac8284f507620 Summary: Support library for PDF documents Requires: emacs-26.3, tablist-1.0, let-alist-1.0.4 Website: https://github.com/vedang/pdf-tools/ Keywords: files multimedia Maintainer: Vedang Manerikar vedang.manerikar@gmail.com Author: Andreas Politz mail@andreas-politz.de Other versions: 20240429.407 (melpa), 1.1.0 (nongnu).pdf-tools
customization / configuration that you use: i dont think i use anyAdditional context I want to have an emacs pdf viewer autoupdating when saving my .tex (running auctex)- struggling hard with approx 0 coding experience
Solution? So i have honestly no idea what i m doing, neither on emacs nor on github (dont even know how to download smth off github to this day), but i located the file in my folders opend it up with emacs as my editor and tried editing the code there. editing vasprint to vsprint does not work, nor adding this: #define __STDC_WANT_LIB_EXT2__ 1
but I saw that the definition of vasprint was there and that it was conditional, since the compiler was lost, the if function must have returned negative but nevertheless run over the now undefined vasprint. So i put the #endif just before the definition of "static int vasprintf..." build succeeded now. I do believe this is not a proper solution so somebody might wanna give this a look I posted this because this gave me massive struggles to continue with my thesis in auctex. It made me reinstall emacs(lastly with msys2 whatever that is), Livetex (does not work through msys2) several times over. that weird pdf-tools server just wouldnt build. So maybe this helps somebody. Instuction Open .emacs.d\elpa\pdf-tools-1.1.0\server\synctex_parser.c on Windows this will be accessable through the C:\Users*your Username*\AppData (AppDate is usually hidden, so you need to press View in your Menu bar -> Show -> and tick Hidden Items)\Roaming Open the file, go to line ~8448 and put the "#endif" in front of the "static int vaspfintf..." save file, run emacs, succees.
Old code:
if defined(_MSC_VER)
include
include
include
static int vasprintf(char *ret, const char format, va_list ap) { int len; len = _vsnprintf(NULL, 0, format, ap); if (len < 0) return -1; ret = malloc(len + 1); if (!ret) return -1; _vsnprintf(ret, len+1, format, ap); (ret)[len] = '\0'; return len; }
endif
/* gzvprintf is not available until OSX 10.10 / static int _synctex_updater_print_gz(synctex_updater_p updater, const char format, ...) { int result = 0; if (updater) { char * buffer; va_list va; va_start(va, format); if (vasprintf(&buffer, format, va) < 0) { _synctex_error("Out of memory..."); } else if ((result = (int)strlen(buffer))) { result = gzwrite(updater->file.as_gzFile, buffer, (unsigned)result); } va_end(va); free(buffer); } return result; } expand_more