emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org 76a5f30034 2/2: ol-info: Use org function instead o


From: ELPA Syncer
Subject: [elpa] externals/org 76a5f30034 2/2: ol-info: Use org function instead of subr-x
Date: Mon, 5 Sep 2022 02:57:56 -0400 (EDT)

branch: externals/org
commit 76a5f300345fabce7c0eb4908eee217c58b663d0
Author: Max Nikulin <manikulin@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    ol-info: Use org function instead of subr-x
    
    * lisp/org-macs.el (org-unbracket-string): Handle empty suffix string.
    * lisp/ol-info.el (org-info--link-file-node):
    (org-info-description-as-command): Use `org-trim' and
    `org-unbracket-string' instead of `string-trim' and
    `string-remove-prefix' from the subr-x package.
---
 lisp/ol-info.el  | 9 ++++-----
 lisp/org-macs.el | 3 ++-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/ol-info.el b/lisp/ol-info.el
index e54fedc066..d332b2837b 100644
--- a/lisp/ol-info.el
+++ b/lisp/ol-info.el
@@ -30,7 +30,6 @@
 
 ;;; Code:
 
-(require 'subr-x) ; `string-trim', `string-remove-prefix'
 (require 'org-macs)
 (org-assert-version)
 
@@ -78,11 +77,11 @@ File may be a virtual one, see `Info-virtual-files'."
       '("dir" . "Top")
     (string-match "\\`\\([^#:]*\\)\\(?:[#:]:?\\(.*\\)\\)?\\'" path)
     (let* ((node (match-string 2 path))
-           ;; Do not reorder, `string-trim' modifies match.
-           (file (string-trim (match-string 1 path))))
+           ;; Do not reorder, `org-trim' modifies match.
+           (file (org-trim (match-string 1 path))))
       (cons
        (if (org-string-nw-p file) file "dir")
-       (if (org-string-nw-p node) (string-trim node) "Top")))))
+       (if (org-string-nw-p node) (org-trim node) "Top")))))
 
 (defun org-info-description-as-command (link desc)
   "Info link description that can be pasted as command.
@@ -106,7 +105,7 @@ If LINK is not an info link then DESC is returned."
          (need-file-node (and (not (org-string-nw-p desc))
                               (string-prefix-p prefix link))))
     (pcase (and need-file-node
-                (org-info--link-file-node (string-remove-prefix prefix link)))
+                (org-info--link-file-node (org-unbracket-string prefix "" 
link)))
       ;; Unlike (info "dir"), "info dir" shell command opens "(coreutils)dir 
invocation".
       (`("dir" . "Top") "info \"(dir)\"")
       (`(,file . "Top") (format "info %s" file))
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 13d872a827..2e4590e93f 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1101,7 +1101,8 @@ removed.  Return the new string.  If STRING is nil, 
return nil."
   (and string
        (if (and (string-prefix-p pre string)
                (string-suffix-p post string))
-          (substring string (length pre) (- (length post)))
+          (substring string (length pre)
+                      (and (not (string-equal "" post)) (- (length post))))
         string)))
 
 (defun org-strip-quotes (string)



reply via email to

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