;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (require 'ht) #@190 Compare two standard ISO 8601 format dates, format is as below: 2012-08-17 1. if date1 is earlier than date2, returns 1 2. if equal, returns 0 3. if date2 is earlier than date1, returns -1 (defalias 'compare-standard-date #[(date1 date2) "\306!\307 8\310 8\311 8\306 ! \307 8\310 8\311 8\nW\2032\312\202j\nV\203=\313\202j W\203H\312\202j V\203S\313\202j\fW\203^\312\202j\fV\203i\313\202j\314.\207" [date1 date-list1 year1 month1 day1 date2 parse-time-string 5 4 3 1 -1 0 date-list2 year2 month2 day2] 2 (#$ . 102)]) #@389 This is a piece of code copied from Xah Lee (I modified a little): Returns yyyy-mm-dd format of date-string For examples: [Nov. 28, 1994] => [1994-11-28] [November 28, 1994] => [1994-11-28] [11/28/1994] => [1994-11-28] Any "day of week", or "time" info, or any other parts of the string, are discarded. Code detail: URL `http://xahlee.org/emacs/elisp_parse_time.html' (defalias 'fix-timestamp-string #[(date-string) "\306\211\211\211\211\211\211@AB\307\310\311B#B\312\313B\"\2039\314\315B\"\316\314\317B\"\316\314\320B\"\260\202\244\312\321B\"\203W\314\315B\"\316\314\317B\"\316\314\320B\"\260\202\244\312\322B\"\203u\314\317B\"\316\314\320B\"\316\314\315B\"\260\202\244\312\323B\"\203\223\314\317B\"\316\314\320B\"\316\314\315B\"\260\202\244\312\324B\"\203\252\314\317B\"\316\314\320B\"Q\202\244\312\325B\"\203\272\314\317B\"\202\244\307\326\327B#B\307\330\331B#B\307\332\333B#B\307\334\335B#B\307\336\337B#B\307\340\341B#B\307\342\343B#B\307\344\345B#B\307\346\347B#B\307\350\351B#B\307\352\353B#B\307\354\355B#B\307\356\357B#B\307\360\361B#B\307\362\363B#B\307\364\311B#B\307\365\366B#B\307\367\370B#B\307\371\372B#B\307\373\374B#B\375B!A\376A8@\377A8\315A8\201C@! \203\206\201D\201E \"\202\211\201F\f\203\231\201D\201E\f\"\202\234\201F \316\n\316 \260.\207" [date-string dd mm yyyy date month nil replace-regexp-in-string "^ *\\(.+\\) *$" "\\1" string-match "^\\([0-9][0-9]\\)/\\([0-9][0-9]\\)/\\([0-9][0-9][0-9][0-9]\\)$" match-string 3 "-" 1 2 "^\\([0-9]\\)/\\([0-9][0-9]\\)/\\([0-9][0-9][0-9][0-9]\\)$" "^\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\)$T[0-9][0-9]:[0-9][0-9]" "^\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\)$" "^\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)$" "^\\([0-9][0-9][0-9][0-9]\\)$" "January " "Jan. " "February " "Feb. " "March " "Mar. " "April " "Apr. " "May " "May. " "June " "Jun. " "July " "Jul. " "August " "Aug. " "September " "Sep. " "October " "Oct. " "November " "Nov. " "December " "Dec. " " 1st," " 1" " 2nd," " 2" " 3rd," " 3" "\\([0-9]\\)th," " 1st " " 1 " " 2nd " " 2 " " 3rd " " 3 " "\\([0-9]\\)th " "\\1 " parse-time-string 5 4 year date-list date-str number-to-string format "%02d" ""] 8 (#$ . 665)]) #@138 Confound email to prevent spams using simple rule: replace . with , @ with , e.g. name@domain.com => name domain com (defalias 'confound-email #[(email) "\301\302\303\301\304\305\301\306\307###\207" [email replace-regexp-in-string " +" " " "@" " " "\\." " "] 10 (#$ . 2982)]) #@141 Return non-nil if STR1 is a suffix of STR2. If IGNORE-CASE is non-nil, the comparison is done without paying attention to case differences. (defalias 'string-suffix-p #[(str1 str2 &optional ignore-case) "G GZ\211\304W?\205\305 \306\211\n\306 &\307=)\207" [str2 str1 pos ignore-case 0 compare-strings nil t] 9 (#$ . 3297)]) #@44 Remove whitespace at the beginning of STR. (defalias 'trim-string-left #[(str) "\301\302\"\203\303\304\305\211$\207\207" [str string-match "\\`[ \n ]+" replace-match "" t] 5 (#$ . 3632)]) #@38 Remove whitespace at the end of STR. (defalias 'trim-string-right #[(str) "\301\302\"\203\303\304\305\211$\207\207" [str string-match "[ \n ]+\\'" replace-match "" t] 5 (#$ . 3832)]) #@260 Remove whitespace at the beginning and end of STR. The function is copied from https://github.com/magnars/s.el, because I do not want to make org-page depend on other libraries, so I copied the function here, so do `trim-string-left' and `trim-string-right'. (defalias 'trim-string #[(str) "\301\302!!\207" [str trim-string-left trim-string-right] 3 (#$ . 4028)]) #@130 Convert a string to legal URL path TODO: improve doc here TODO2: maybe DBCS strings should also be converted into ASCII URL path (defalias 'convert-string-to-path #[(string) "\301\302\303#\227\207" [string replace-regexp-in-string "[ :/\\]+" "-"] 4 (#$ . 4400)]) #@53 Read the content of FILE and return it as a string. (defalias 'file-to-string #[(file) "\302\303\304\"rq\210\305\216\306 !\210\307 +\207" [#1=#:temp-buffer file generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] insert-file-contents buffer-string] 3 (#$ . 4670)]) #@131 Write STRING into FILE, only when FILE is writable. If MODE is a valid major mode, format the string with MODE's format settings. (defalias 'string-to-file #[(string file &optional mode) "\304\305\306\"rq\210\307\216 c\210\310\311!\210\n\203/\312\n!\203/\n \210\313\314ed#\210\315ed\"\210\316ed\"\210\317 !\205:\320ed #+\207" [#1=#:temp-buffer string mode file generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] set-buffer-file-coding-system utf-8-unix functionp flush-lines "^[ \\t]*$" delete-trailing-whitespace indent-region file-writable-p write-region] 4 (#$ . 4988)]) #@187 Convert normal property list PLIST into hash table, keys of PLIST should be in format :key, and it will be converted into "key" in hash table. This is an alternative to `ht-from-plist'. (defalias 'convert-plist-to-hashtable #[(plist) "\306\307\310\"\311 !\312\211\203, @\313\n@!\314\312O\nA@\315 \f#\210* A\211\204\312+\207" [h plist pair --dolist-tail-- value key make-hash-table :test equal ht/group-pairs nil symbol-name 1 puthash] 5 (#$ . 5619)]) (provide 'op-util)