On Tue, Oct 17, 2017 at 5:39 PM Berry, Charles wrote: > I think this might work: Add `after' advice to `org-babel-exp-code' that > copies the header args you want to retain and prepends a #+header: line > with them to the string returned by org-babel-exp-code. Then your > src-block transcoder can find them. > Thanks, TIL about org-babel-exp-code. Thanks for the instructions, below works perfectly! ===== (defun org-babel-exp-code--retain (orig-fun &rest args) "Return the original code block formatted for export." (let* ((param-keys-to-be-retained '(:hl_lines :foo)) ;Example of keys whose conses need to be retained (info (car args)) (parameters (nth 2 info)) (ox-hugo-params-str (let ((str "")) (dolist (param parameters) (dolist (retain-key param-keys-to-be-retained) (when (equal retain-key (car param)) (setq str (concat str " " (symbol-name retain-key) " " (cdr param)))))) (org-string-nw-p (org-trim str)))) ret) (setq ret (apply orig-fun args)) ;Original return value (when ox-hugo-params-str (setq ret (replace-regexp-in-string "\\`#\\+BEGIN_SRC .*" (format "\\& %s" ox-hugo-params-str) ret))) ret)) (advice-add 'org-babel-exp-code :around #'org-babel-exp-code--retain) ===== Test: ===== #+BEGIN_SRC emacs-lisp :eval no-export :results output silent :hl_lines 1,3-4 :foo bar (message "foo") #+END_SRC ===== The messages based on the debug code I pasted earlier in this thread now look like: ===== [src-block dbg] number-lines: nil [src-block dbg] switches: nil [src-block dbg] parameters: ":foo bar :hl_lines 1,3-4" ===== -- Kaushal Modi