-
Notifications
You must be signed in to change notification settings - Fork 19
Removed dependency on s.el. #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amno1
wants to merge
1
commit into
Wilfred:master
Choose a base branch
from
amno1:remove-s
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,9 +33,9 @@ | |
| ;;; Code: | ||
|
|
||
| (require 'dash) | ||
| (require 's) | ||
| (require 'format) | ||
| (eval-when-compile (require 'cl-lib)) | ||
| (eval-when-compile (require 'subr-x)) | ||
|
|
||
| ;;; Internal | ||
|
|
||
|
|
@@ -52,7 +52,7 @@ | |
| (push (format "%d" number) parts) | ||
| (concat | ||
| (if (< integer 0) "-" "") | ||
| (s-join "," parts)))) | ||
| (string-join parts ",")))) | ||
|
|
||
| (defsubst elisp-refs--start-pos (end-pos) | ||
| "Find the start position of form ending at END-POS | ||
|
|
@@ -398,14 +398,14 @@ don't want to create lots of temporary buffers.") | |
| "Replace tabs in STRING with spaces." | ||
| ;; This is important for unindenting, as we may unindent by less | ||
| ;; than one whole tab. | ||
| (s-replace "\t" (s-repeat tab-width " ") string)) | ||
| (replace-regexp-in-string "\t" (make-string tab-width ?\s) string)) | ||
|
|
||
| (defun elisp-refs--lines (string) | ||
| "Return a list of all the lines in STRING. | ||
| 'a\nb' -> ('a\n' 'b')" | ||
| (let ((lines nil)) | ||
| (while (> (length string) 0) | ||
| (let ((index (s-index-of "\n" string))) | ||
| (let ((index (string-match-p "\n" string))) | ||
| (if index | ||
| (progn | ||
| (push (substring string 0 (1+ index)) lines) | ||
|
|
@@ -427,11 +427,11 @@ at least one line has no indent. | |
|
|
||
| STRING should have a 'elisp-refs-start-pos property. The returned | ||
| string will have this property updated to reflect the unindent." | ||
| (let* ((lines (s-lines string)) | ||
| ;; Get the leading whitespace for each line. | ||
| (indents (--map (car (s-match (rx bos (+ whitespace)) it)) | ||
| lines)) | ||
| (min-indent (-min (--map (length it) indents)))) | ||
| (let* ((lines (split-string string "\n")) | ||
| (min-indent most-positive-fixnum) (indent 0)) | ||
| (dolist (line lines) | ||
| (setq indent (or (string-match-p "[^[:blank:]]" line) 0)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why remove the use of |
||
| (if (> min-indent indent) (setq min-indent indent))) | ||
| (propertize | ||
| (elisp-refs--map-lines | ||
| string | ||
|
|
@@ -542,8 +542,13 @@ KIND should be 'function, 'macro, 'variable, 'special or 'symbol." | |
| (elisp-refs--pluralize searched-file-count "loaded file") | ||
| (elisp-refs--path-button (file-name-as-directory prefix))) | ||
| (format "Searched all %s loaded in Emacs." | ||
| (elisp-refs--pluralize searched-file-count "file"))))) | ||
| (s-word-wrap 70 (format "%s %s" found-str searched-str)))) | ||
| (elisp-refs--pluralize searched-file-count | ||
| "file"))))) | ||
| (with-temp-buffer | ||
| (insert found-str " " searched-str) | ||
| (let ((fill-column 70)) | ||
| (fill-region (point-min) (point-max))) | ||
| (buffer-string)))) | ||
|
|
||
| ;; TODO: if we have multiple matches on one line, we repeatedly show | ||
| ;; that line. That's slightly confusing. | ||
|
|
@@ -628,7 +633,7 @@ MATCH-FN should return a list where each element takes the form: | |
| \(form start-pos end-pos)." | ||
| (let* ((loaded-paths (elisp-refs--loaded-paths)) | ||
| (matching-paths (if path-prefix | ||
| (--filter (s-starts-with? path-prefix it) loaded-paths) | ||
| (--filter (string-prefix-p path-prefix it) loaded-paths) | ||
| loaded-paths)) | ||
| (loaded-src-bufs (mapcar #'elisp-refs--contents-buffer matching-paths))) | ||
| ;; Use unwind-protect to ensure we always cleanup temporary | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elisp has bignums now so I would find it more elegant to do away with the arbitrary fixnum limit, e.g. by continuing to use Dash helpers (min-by, reduce), or by using
nilor similar as an initial value.The
indentvariable can be moved into the loop to avoid the need forsetq(which should make it slightly more efficient too).