From mboxrd@z Thu Jan 1 00:00:00 1970 From: immanuel Subject: Bug: org-babel-tangle-clean seems buggy [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)] Date: Sat, 31 Aug 2019 09:46:04 +0200 Message-ID: <87y2z993r7.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:37448) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i3y5K-0001Oc-VR for emacs-orgmode@gnu.org; Sat, 31 Aug 2019 03:46:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i3y5H-0006o9-VI for emacs-orgmode@gnu.org; Sat, 31 Aug 2019 03:46:10 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:37772) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i3y5H-0006lC-Lv for emacs-orgmode@gnu.org; Sat, 31 Aug 2019 03:46:07 -0400 Received: by mail-wm1-x341.google.com with SMTP id d16so9619548wme.2 for ; Sat, 31 Aug 2019 00:46:07 -0700 (PDT) Received: from prometheus (ip-213-49-242-187.dsl.scarlet.be. [213.49.242.187]) by smtp.gmail.com with ESMTPSA id x10sm10370715wrn.39.2019.08.31.00.46.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 31 Aug 2019 00:46:05 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. ------------------------------------------------------------------------ When running 'org-babel-tangle-clean on this buffer: >> [[file:foo][something]] <> [[file:bar][something else]] <> >> I get >> <> >> Given the code of that function -- especially the (while (or -- it's highly unlikely that that code does what the docstring says it does. I'm also not clear on why you'd want to remove noweb references. #+BEGIN_SRC emacs-lisp (defun org-babel-tangle-clean () "Remove comments inserted by `org-babel-tangle'. Call this function inside of a source-code file generated by `org-babel-tangle' to remove all comments inserted automatically by `org-babel-tangle'. Warning, this comment removes any lines containing constructs which resemble Org file links or noweb references." (interactive) (goto-char (point-min)) (while (or (re-search-forward "\\[\\[file:.*\\]\\[.*\\]\\]" nil t) (re-search-forward (org-babel-noweb-wrap) nil t)) (delete-region (save-excursion (beginning-of-line 1) (point)) (save-excursion (end-of-line 1) (forward-char 1) (point))))) #END_SRC Immanuel Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-07-17 Package: Org mode version 9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/) current state: ============== (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-link-shell-confirm-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-odt-format-headline-function 'org-odt-format-headline-default-function org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-mode-hook '((closure (org-agenda-skip-regexp org-table1-hline-regexp org-table-tab-recognizes-table\.el org-table-dataline-regexp org-table-any-border-regexp org-agenda-restriction-lock-overlay org-agenda-overriding-restriction org-agenda-diary-file org-complex-heading-regexp calendar-mode-map t) nil (setq imenu-create-index-function (quote org-imenu-get-tree))) (closure (org--rds reftex-docstruct-symbol org-element-greater-elements org-clock-history org-agenda-current-date org-with-time org-defdecode org-def org-read-date-inactive org-ans2 org-ans1 org-columns-current-fmt-compiled org-clock-current-task org-clock-effort org-agenda-skip-function org-agenda-skip-comment-trees org-agenda-archives-mode org-end-time-was-given org-time-was-given org-log-note-extra org-log-note-purpose org-log-post-message org-last-inserted-timestamp org-last-changed-timestamp org-entry-property-inherited-from org-blocked-by-checkboxes org-state org-agenda-headline-snapshot-before-repeat org-capture-last-stored-marker org-agenda-start-on-weekday org-agenda-buffer-tmp-name org-priority-regexp org-mode-abbrev-table org-mode-syntax-table buffer-face-mode-face org-tbl-menu org-org-menu org-struct-menu org-entities org-last-state org-id-track-globally org-clock-start-time texmathp-why remember-data-file org-agenda-tags-todo-honor-ignore-options iswitchb-temp-buflist align-mode-rules-list org-emphasis-alist org-emphasis-regexp-components org-export-registered-backends org-modules org-babel-load-languages org-indent-indentation-per-level org-element-paragraph-separate ffap-url-regexp org-inlinetask-min-level t) nil (add-hook (quote change-major-mode-hook) (quote org-show-all) (quote append) (quote local))) (closure (org-src-window-setup *this* org-babel-confirm-evaluate-answer-no org-src-preserve-indentation org-src-lang-modes org-link-file-path-type org-edit-src-content-indentation org-babel-library-of-babel t) nil (add-hook (quote change-major-mode-hook) (quote org-babel-show-result-all) (quote append) (quote local))) org-babel-result-hide-spec org-babel-hide-all-hashes auto-fill-mode) org-odt-format-drawer-function '(closure (hfy-user-sheet-assoc hfy-html-quote-regex hfy-html-quote-map hfy-face-to-css hfy-begin-span-handler hfy-end-span-handler archive-zip-extract nxml-auto-insert-xml-declaration-flag t) (_name contents) contents) org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-latex-format-drawer-function '(closure (t) (_ contents) contents) org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages '((emacs-lisp . t) (C) (python . t) (shell . t) (plantuml . t)) org-ascii-format-drawer-function '(closure (t) (_name contents _width) contents) org-babel-python-command "ipython --simple-prompt -i --pylab" org-src-preserve-indentation t org-occur-hook '(org-first-headline-recenter) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el") ("elisp" . "el")) org-confirm-shell-link-function 'yes-or-no-p org-link-parameters '(("eww" :follow eww :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("attachment" :follow org-attach-open-link :export org-attach-export-link :complete org-attach-complete-link) ("id" :follow org-id-open) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow (closure ((scheme . "news") (--dolist-tail--) org-ts-regexp org-time-stamp-formats org-outline-regexp-bol org-inhibit-startup org-id-link-to-org-use-id org-highlight-links org-comment-string org-agenda-buffer-name clean-buffer-list-kill-buffer-names t) (url) (browse-url (concat scheme ":" url))) ) ("mailto" :follow (closure ((scheme . "mailto") (--dolist-tail--) org-ts-regexp org-time-stamp-formats org-outline-regexp-bol org-inhibit-startup org-id-link-to-org-use-id org-highlight-links org-comment-string org-agenda-buffer-name clean-buffer-list-kill-buffer-names t) (url) (browse-url (concat scheme ":" url))) ) ("https" :follow (closure ((scheme . "https") (--dolist-tail--) org-ts-regexp org-time-stamp-formats org-outline-regexp-bol org-inhibit-startup org-id-link-to-org-use-id org-highlight-links org-comment-string org-agenda-buffer-name clean-buffer-list-kill-buffer-names t) (url) (browse-url (concat scheme ":" url))) ) ("http" :follow (closure ((scheme . "http") (--dolist-tail--) org-ts-regexp org-time-stamp-formats org-outline-regexp-bol org-inhibit-startup org-id-link-to-org-use-id org-highlight-links org-comment-string org-agenda-buffer-name clean-buffer-list-kill-buffer-names t) (url) (browse-url (concat scheme ":" url))) ) ("ftp" :follow (closure ((scheme . "ftp") (--dolist-tail--) org-ts-regexp org-time-stamp-formats org-outline-regexp-bol org-inhibit-startup org-id-link-to-org-use-id org-highlight-links org-comment-string org-agenda-buffer-name clean-buffer-list-kill-buffer-names t) (url) (browse-url (concat scheme ":" url))) ) ("help" :follow org-link--open-elisp) ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp) ("doi" :follow org-link--open-doi)) org-latex-format-headline-function 'org-latex-format-headline-default-function org-link-elisp-confirm-function 'yes-or-no-p org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function org-html-format-drawer-function '(closure (htmlize-buffer-places org-html-format-table-no-css htmlize-css-name-prefix htmlize-output-type htmlize-output-type htmlize-css-name-prefix t) (_name contents) contents) org-attach-id-to-path-function 'org-attach-id-folder-format org-html-format-headline-function 'org-html-format-headline-default-function org-src-window-setup 'split-window-below org-confirm-babel-evaluate nil )