emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-babel-tangle-clean seems buggy [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)]
@ 2019-08-31  7:46 immanuel
  0 siblings, 0 replies; only message in thread
From: immanuel @ 2019-08-31  7:46 UTC (permalink / raw)
  To: emacs-orgmode


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]]

<<test me one >>
[[file:bar][something else]]

<<test me>>

>>

I get

>>
<<test me one >>
>>


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
 )

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-31  7:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-31  7:46 Bug: org-babel-tangle-clean seems buggy [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)] immanuel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).