MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 18.117.158.174
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/share/emacs/24.3/lisp/org/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/share/emacs/24.3/lisp/org/org-protocol.elc
;ELC
;;; Compiled by mockbuild@buildfarm06-new.corp.cloudlinux.com on Fri Oct 11 10:07:55 2024
;;; from file /builddir/build/BUILD/emacs-24.3/lisp/org/org-protocol.el
;;; in Emacs version 24.3.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.

;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(byte-code "\300\301!\210\302\303\304\305#\210\306\303\304\307#\210\302\310\311\305#\210\306\310\311\307#\210\302\312\313\305#\210\306\312\313\307#\210\314\315\305\316\317\320\321\322\321\301&	\207" [require org defalias org-protocol-unhex-compound org-link-unescape-compound nil make-obsolete "2011-02-17" org-protocol-unhex-string org-link-unescape org-protocol-unhex-single-byte-sequence org-link-unescape-single-byte-sequence custom-declare-group org-protocol "Intercept calls from emacsclient to trigger custom actions.\n\nThis is done by advising `server-visit-files' to scan the list of filenames\nfor `org-protocol-the-protocol' and sub-protocols defined in\n`org-protocol-protocol-alist' and `org-protocol-protocol-alist-default'." :version "22.1" :group convenience] 10)
#@97 Default protocols to use.
See `org-protocol-protocol-alist' for a description of this variable.
(defconst org-protocol-protocol-alist-default '(("org-remember" :protocol "remember" :function org-protocol-remember :kill-client t) ("org-capture" :protocol "capture" :function org-protocol-capture :kill-client t) ("org-store-link" :protocol "store-link" :function org-protocol-store-link) ("org-open-source" :protocol "open-source" :function org-protocol-open-source)) (#$ . 1340))
#@338 This is the protocol to detect if org-protocol.el is loaded.
`org-protocol-protocol-alist-default' and `org-protocol-protocol-alist' hold
the sub-protocols that trigger the required action.  You will have to define
just one protocol handler OS-wide (MS-Windows) or per application (Linux).
That protocol handler should call emacsclient.
(defconst org-protocol-the-protocol "org-protocol" (#$ . 1827))
(byte-code "\300\301\302\303\304\305\306\307&\210\300\310\311\312\304\305\306\313&\210\300\314\311\315\304\305\306\316&\210\300\317\311\320\304\305\306\321&\210\300\322\323\324\304\305\306\321&\207" [custom-declare-variable org-protocol-reverse-list-of-files t "Non-nil means re-reverse the list of filenames passed on the command line.\nThe filenames passed on the command line are passed to the emacs-server in\nreverse order.  Set to t (default) to re-reverse the list, i.e. use the\nsequence on the command line.  If nil, the sequence of the filenames is\nunchanged." :group org-protocol :type boolean org-protocol-project-alist nil "Map URLs to local filenames for `org-protocol-open-source' (open-source).\n\nEach element of this list must be of the form:\n\n  (module-name :property value property: value ...)\n\nwhere module-name is an arbitrary name.  All the values are strings.\n\nPossible properties are:\n\n  :online-suffix     - the suffix to strip from the published URLs\n  :working-suffix    - the replacement for online-suffix\n  :base-url          - the base URL, e.g. http://www.example.com/project/\n                       Last slash required.\n  :working-directory - the local working directory.  This is, what base-url will\n                       be replaced with.\n  :redirects         - A list of cons cells, each of which maps a regular\n                       expression to match to a path relative to :working-directory.\n\nExample:\n\n   (setq org-protocol-project-alist\n       '((\"http://orgmode.org/worg/\"\n          :online-suffix \".php\"\n          :working-suffix \".org\"\n          :base-url \"http://orgmode.org/worg/\"\n          :working-directory \"/home/user/org/Worg/\")\n         (\"http://localhost/org-notes/\"\n          :online-suffix \".html\"\n          :working-suffix \".org\"\n          :base-url \"http://localhost/org/\"\n          :working-directory \"/home/user/org/\"\n          :rewrites ((\"org/?$\" . \"index.php\")))))\n\n   The last line tells `org-protocol-open-source' to open\n   /home/user/org/index.php, if the URL cannot be mapped to an existing\n   file, and ends with either \"org\" or \"org/\".\n\nConsider using the interactive functions `org-protocol-create' and\n`org-protocol-create-for-org' to help you filling this variable with valid contents." alist org-protocol-protocol-alist "Register custom handlers for org-protocol.\n\nEach element of this list must be of the form:\n\n  (module-name :protocol protocol :function func :kill-client nil)\n\nprotocol - protocol to detect in a filename without trailing colon and slashes.\n           See rfc1738 section 2.1 for more on this.\n           If you define a protocol \"my-protocol\", `org-protocol-check-filename-for-protocol'\n           will search filenames for \"org-protocol:/my-protocol:/\"\n           and trigger your action for every match. `org-protocol' is defined in\n           `org-protocol-the-protocol'.  Double and triple slashes are compressed\n           to one by emacsclient.\n\nfunction - function that handles requests with protocol and takes exactly one\n           argument: the filename with all protocols stripped.  If the function\n           returns nil, emacsclient and -server do nothing.  Any non-nil return\n           value is considered a valid filename and thus passed to the server.\n\n           `org-protocol.el provides some support for handling those filenames,\n           if you stay with the conventions used for the standard handlers in\n           `org-protocol-protocol-alist-default'.  See `org-protocol-split-data'.\n\nkill-client - If t, kill the client immediately, once the sub-protocol is\n           detected.  This is necessary for actions that can be interrupted by\n           `C-g' to avoid dangling emacsclients.  Note, that all other command\n           line arguments but the this one will be discarded, greedy handlers\n           still receive the whole list of arguments though.\n\nHere is an example:\n\n  (setq org-protocol-protocol-alist\n      '((\"my-protocol\"\n         :protocol \"my-protocol\"\n         :function my-protocol-handler-function)\n        (\"your-protocol\"\n         :protocol \"your-protocol\"\n         :function your-protocol-handler-function)))" (alist) org-protocol-default-template-key "The default template key to use.\nThis is usually a single character string but can also be a\nstring with two characters." string org-protocol-data-separator "/+" "The default data separator to use.\n   This should be a single regexp string."] 8)
#@97 emacsclient compresses double and triple slashes.
Slashes are sanitized to double slashes here.
(defalias 'org-protocol-sanitize-uri #[(uri) "\302\303\"\203\304\305\"\211@\306\307\310	A\311#Q)\207" [uri splitparts string-match "^\\([a-z]+\\):/" split-string "/+" "//" mapconcat identity "/"] 7 (#$ . 6801)])
#@396 Split what an org-protocol handler function gets as only argument.
DATA is that one argument.  DATA is split at each occurrence of
SEPARATOR (regexp).  If no SEPARATOR is specified or SEPARATOR is
nil, assume "/+".  The results of that splitting are returned
as a list.  If UNHEXIFY is non-nil, hex-decode each split part.
If UNHEXIFY is a function, use that function to decode each split
part.
(defalias 'org-protocol-split-data #[(data &optional unhexify separator) "\206\305\306\n	\"\f\203#\307\f!\203\310\f\"\202$\310\311\"\202$*\207" [separator sep data split-parts unhexify "/+" split-string fboundp mapcar org-link-unescape] 3 (#$ . 7123)])
#@833 Greedy handlers might receive a list like this from emacsclient:
 '(("/dir/org-protocol:/greedy:/~/path1" (23 . 12)) ("/dir/param")
where "/dir/" is the absolute path to emacsclients working directory.  This
function transforms it into a flat list using `org-protocol-flatten' and
transforms the elements of that list as follows:

If strip-path is non-nil, remove the "/dir/" prefix from all members of
param-list.

If replacement is string, replace the "/dir/" prefix with it.

The first parameter, the one that contains the protocols, is always changed.
Everything up to the end of the protocols is stripped.

Note, that this function will always behave as if
`org-protocol-reverse-list-of-files' was set to t and the returned list will
reflect that.  I.e. emacsclients first parameter will be the first one in the
returned list.
(defalias 'org-protocol-flatten-greedy #[(param-list &optional strip-path replacement) "\306\203		\202\f\307	!!\211@\310\311\211\312\313\"\2030\314\315\"\211G\n
\314\316\"P\240\210\203\207\n\311\211\203{@\317;\203l;\203a\f\311OP\211\202n\f\311O\211\202nC\"A\211\204?\311\210*\202\210\n-\207" [org-protocol-reverse-list-of-files param-list l trigger len dir org-protocol-flatten reverse 0 nil string-match "^\\(.*\\)\\(org-protocol:/+[a-zA-z0-9][-_a-zA-z0-9]*:/+\\)\\(.*\\)" match-string 1 3 append ret strip-path e --dolist-tail-- replacement] 7 (#$ . 7791)])
#@250 Greedy handlers might receive a list like this from emacsclient:
 '( ("/dir/org-protocol:/greedy:/~/path1" (23 . 12)) ("/dir/param")
where "/dir/" is the absolute path to emacsclients working directory.
This function transforms it into a flat list.
(defalias 'org-protocol-flatten #[(l) "\205<\203\301\302@!\302A!\"\207C\207" [l append org-protocol-flatten] 4 (#$ . 9253)])
#@590 Process an org-protocol://store-link:// style url.
Additionally store a browser URL as an org link.  Also pushes the
link's URL to the `kill-ring'.

The location for a browser's bookmark has to look like this:

  javascript:location.href='org-protocol://store-link://'+ \
        encodeURIComponent(location.href)
        encodeURIComponent(document.title)+'/'+ \

Don't use `escape()'! Use `encodeURIComponent()' instead.  The title of the page
could contain slashes and the location definitely will.

The sub-protocol used to reach this function is set in
`org-protocol-protocol-alist'.
(defalias 'org-protocol-store-link #[(fname) "\306\307	#\310\n@!\n\211A@)\311\312\313!\203#
DB\314!\210\315\316\317\320!\317\321!$\210,\311\207" [fname org-protocol-data-separator splitparts uri x title org-protocol-split-data t org-protocol-sanitize-uri nil boundp org-stored-links kill-new message "`%s' to insert new org-link, `%s' to insert `%s'" substitute-command-keys "\\[org-insert-link]" "\\[yank]" orglink] 6 (#$ . 9643)])
#@383 Process an org-protocol://remember:// style url.

The location for a browser's bookmark has to look like this:

  javascript:location.href='org-protocol://remember://'+ \
        encodeURIComponent(location.href)+'/' \
        encodeURIComponent(document.title)+'/'+ \
        encodeURIComponent(window.getSelection())

See the docs for `org-protocol-capture' for more information.
(defalias 'org-protocol-remember #[(info) "\301\302!\203\303\304!\203\305\306\"\203\307\310!\210\311\207" [info boundp org-stored-links fboundp org-capture org-protocol-do-capture org-remember message "Item remembered." nil] 3 (#$ . 10687)])
#@788 Process an org-protocol://capture:// style url.

The sub-protocol used to reach this function is set in
`org-protocol-protocol-alist'.

This function detects an URL, title and optional text, separated by '/'
The location for a browser's bookmark has to look like this:

  javascript:location.href='org-protocol://capture://'+ \
        encodeURIComponent(location.href)+'/' \
        encodeURIComponent(document.title)+'/'+ \
        encodeURIComponent(window.getSelection())

By default, it uses the character `org-protocol-default-template-key',
which should be associated with a template in `org-capture-templates'.
But you may prepend the encoded URL with a character and a slash like so:

  javascript:location.href='org-protocol://capture://b/'+ ...

Now template ?b will be used.
(defalias 'org-protocol-capture #[(info) "\301\302!\203\303\304!\203\305\304\"\203\306\307!\210\310\207" [info boundp org-stored-links fboundp org-capture org-protocol-do-capture message "Item captured." nil] 3 (#$ . 11325)])
#@116 Support `org-capture' and `org-remember' alike.
CAPTURE-FUNC is either the symbol `org-remember' or `org-capture'.
(defalias 'org-protocol-do-capture #[(info capture-func) "\306\307	#\310\n@GY\203\n\211A@\206\311\n@!\312\313
\"\205(\314\315
\"\n\211A@)\2065\316\nAA@\206?\316\317
\312\320\"\203P\202Q
\"\307\321 
D!B!\322!\210\323\324\325
\326\327\330&\n\210\331 \210\"\321\f\".	\207" [info org-protocol-data-separator parts org-protocol-default-template-key template url org-protocol-split-data t 2 org-protocol-sanitize-uri string-match "^\\([a-z]+\\):" match-string 1 "" org-make-link-string "[^[:space:]]" nil kill-new org-store-link-props :type :link :description :annotation :initial raise-frame type x title region orglink org-capture-link-is-already-stored remember-annotation-functions org-stored-links capture-func] 12 (#$ . 12352)])
#@314 Process an org-protocol://open-source:// style url.

Change a filename by mapping URLs to local filenames as set
in `org-protocol-project-alist'.

The location for a browser's bookmark should look like this:

  javascript:location.href='org-protocol://open-source://'+ \
        encodeURIComponent(location.href)
(defalias 'org-protocol-open-source #[(fname) "\303\304!\302\305\215*\207" [fname f result nil org-link-unescape (byte-code "\306\211\203\262\n@\307	A\310\"\311!\312\f
\"\203\252\307	A\313\"\307	A\314\"\307	A\315\"
\316\312\317
\"O\312\f\"G\\ \312\311!\"! !OP\211\"P#\320#!\204\205\321\322#\"\210\307	A\323\"\211$\203\204\321\324$\"\210\325\326$\"\210)\327#!\203\222\330\331#\"\210\320#!\203\242\321\332#\"\210\202\250\321\333#\"\210.*\nA\211\204*\207" [org-protocol-project-alist prolist --dolist-tail-- base-url wsearch f nil plist-get :base-url regexp-quote string-match :working-directory :online-suffix :working-suffix 0 "\\([\\?#].*\\)?$" file-exists-p message "File %s does not exist.\nTesting for rewritten URLs." :rewrites "Rewrites found: %S" mapc #[(rewrite) "\303@	\"\205\304\305\nAP\"\207" [rewrite f2 wdir string-match throw result] 4 "Try to match a rewritten URL and map it to a real file."] file-readable-p throw result "%s: permission denied!" "%s: no such file or directory." wdir strip-suffix add-suffix f1 start-pos end-pos f2 the-file rewrites] 6)] 3 (#$ . 13250)])
#@672 Detect if `org-protocol-the-protocol' and a known sub-protocol is used in fname.
Sub-protocols are registered in `org-protocol-protocol-alist' and
`org-protocol-protocol-alist-default'.
This is, how the matching is done:

  (string-match "protocol:/+sub-protocol:/+" ...)

protocol and sub-protocol are regexp-quoted.

If a matching protocol is found, the protocol is stripped from fname and the
result is passed to the protocols function as the only parameter.  If the
function returns nil, the filename is removed from the list of filenames
passed from emacsclient to the server.
If the function returns a non nil value, that value is passed to the server
as filename.
(defalias 'org-protocol-check-filename-for-protocol #[(fname restoffiles client) "\303	\"\304\305\215)\207" [org-protocol-protocol-alist org-protocol-protocol-alist-default sub-protocols append fname (byte-code "\306!\307P\310	\n\"\203\216\311\211\203\215
@	\306\312\fA\313\"!\307Q\310\n\"\203\205\312\fA\314\"\312\fA\315\"\316\n\"\203K\202S\211A@)\312\fA\317\"\203d\320\321!\210\322 \210\323!\203\204\204y\324\302!\"\210!\210\324\302\325\"\210,)
A\211\204*)\n\207" [org-protocol-the-protocol the-protocol fname sub-protocols prolist --dolist-tail-- regexp-quote ":/+" string-match nil plist-get :protocol :function :greedy split-string :kill-client message "Greedy org-protocol handler.  Killing client." server-edit fboundp throw t proto func greedy split restoffiles x result] 6)] 3 (#$ . 14722)])
(byte-code "\300\301\302\303\304$\210\305\301\304\"\207" [ad-add-advice server-visit-files (org-protocol-detect-protocol-server nil t (advice lambda nil "Advice server-visit-flist to call `org-protocol-modify-filename-for-protocol'." (let ((flist (if org-protocol-reverse-list-of-files (reverse (ad-get-arg 0)) (ad-get-arg 0))) (client (ad-get-arg 1))) (catch 'greedy (dolist (var flist) (let ((fname (expand-file-name (car var)))) (setq fname (org-protocol-check-filename-for-protocol fname (member var flist) client)) (if (eq fname t) (progn (ad-set-arg 0 nil) (throw 'greedy t)) (if (stringp fname) (setcar var fname) (ad-set-arg 0 (delq var (ad-get-arg 0))))))))))) before nil ad-activate] 5)
#@235 Create a org-protocol project for the current file's Org-mode project.
This works, if the file visited is part of a publishing project in
`org-publish-project-alist'.  This function calls `org-protocol-create' to do
most of the work.
(defalias 'org-protocol-create-for-org #[nil "\302\303!\210\304!\211\203\305	A!\202\306\307\310\311!\")\207" [buffer-file-name all require org-publish org-publish-get-project-from-filename org-protocol-create message "Not in an org-project.  Did mean %s?" substitute-command-keys "\\[org-protocol-create]"] 5 (#$ . 16951) nil])
#@372 Create a new org-protocol project interactively.
An org-protocol project is an entry in `org-protocol-project-alist'
which is used by `org-protocol-open-source'.
Optionally use project-plist to initialize the defaults for this project.  If
project-plist is the CDR of an element in `org-publish-project-alist', reuse
:base-directory, :html-extension and :base-extension.
(defalias 'org-protocol-create #[(&optional project-plist) "\306\307\310\"\206		!\311\307\312\"\206\313\307\314\"\203#\315\307\314\"P\202$\316\317\320\317#$%\321\322$\317$\320%$\323\324$\"\204J$\325P$\306\326\327%\211\320$!%\323\324%\"\204c%\325P%\321\330#\331Q#\317#\320%#\321\332
\331Q
\317
\320%\333\334!\205\234$\335$\336%\337#\340
\257	\"B\"\341\342\"\".\207" [project-plist default-directory minibuffer-allow-text-properties insert-default-directory worglet-buffer working-suffix expand-file-name plist-get :base-directory "http://orgmode.org/worg/" :html-extension ".html" :base-extension "." ".org" nil t read-string "Base URL of published content: " string-match "\\/$" "/" read-directory-name "Local working directory: " "Extension to strip from published URLs (" "): " "Extension of editable files (" yes-or-no-p "Save the new org-protocol-project to your init file? " :base-url :working-directory :online-suffix :working-suffix customize-save-variable org-protocol-project-alist strip-suffix base-url working-dir] 9 (#$ . 17526) nil])
(provide 'org-protocol)

MMCT - 2023