emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Accept more :tangle-mode specification forms


From: Max Nikulin
Subject: Re: [PATCH] Accept more :tangle-mode specification forms
Date: Wed, 6 Oct 2021 18:59:55 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 05/10/2021 21:45, Timothy wrote:

Indeed, I’ve basically supported every form I could think of. I’m currently
inclined to cut it down to:
• 755
• “rwxrw-r–” (`ls -l’ style)
• chmod style with `org-babel-tangle-default-mode’ and 
`file-modes-symbolic-to-number’

Maybe with (if anybody says they would like this)
• #o755 (elisp octal)
• 0755 (C octal)
• “rwx” = user perm, bit-or’d with `org-babel-tangle-default-mode’ for the rest
   (i.e. `org-babel-tangle-default-mode’, but not exceeding the user perm)

My opinion (discussion should not mean that I insist) is that since the following is currently working

#+begin_src bash :tangle yes :tangle-mode 755
  echo "Hello"
#+end_src

naked numbers (strings looking like numbers) should be forbidden. `org-lint' should report such lines and it should be at least warning for `org-babel-tagle'.

It is safer to define macros (namely macros, not just functions) that check argument type, e.g.

(filemode-octal "755") ; OK
(filemode-octal #o755) ; OK
(filemode-octal 755) ; Error

Maybe they should return not just raw number but e.g. tagged pair
(#o755 . 'filemode)

The point is that it should be hard to pass decimal or hex number (though it might be possible through a function generating tagged cons).

It is better to be a bit more verbose and explicit than to allow weird hard to notice later errors. Problem cases are too close to valid ones with current behavior.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]