* Sharon Kimble <boudic...@skimble09.plus.com> [2025-08-04 10:53]: > > Is it possible to have a link in file B to file A, which when double-clicked, > or C-c'ed, or some other form of automating it, causes file A to activate > please? > > The backstory is that I'm copying my blog posts (written in org-mode of > course) into file B, and then opening file A and compiling it into a latex > file which I then build my pdf from, to give a pdf file containing my blog > postings. > > But what I want to happen is that by double-clicking the link in file B (or > some other method of activating it that I don't know about, yet), it > automatically compiles file A without me having to open it first.
Here is how that problem can be solved: First, Emacs Lisp function which will ensure that file is exported, but function is not perfect: (defun my-org-compile-file (path) "Compile the file at PATH." (let ((default-directory (file-name-directory path))) (find-file path) (org-latex-export-to-pdf) (kill-buffer (current-buffer)))) Now problem is that function `org-latex-export-to-pdf' has various other parameters that you may need... Anyway... let us continue. Let us say you wish to invoke that function on very specific file: (defun my-org-compile-my-specific-file () (interactive) (my-org-compile-file "/my/specific/file")) Then you can bind the function on the key: (local-set-key "F9" #'my-org-compile-my-specific-file) or you could just invoke it M-x my-org-compile-my-specific-file RET Now, you can have file-A.org: ----------------------------- #+TITLE: File A * Hello there And this file can insert things from file-B.org Then file-B.org --------------- #+TITLE: File B here * TODO [[compile:/home/data1/protected/file-A.org][Compile file A]] * Here some notes ---------------- Now when you click on the link inside of file B, it will compile the file A and produce the PDF file. You can improve to open the PDF file if you wish. The concept can also be made with the standard Makefile and using Tools --> Compile options. But let us see on your feedback first... -- Jean Louis