[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs 30.0 warning from `cl-pushnew' and `memql'
From: |
Emanuel Berg |
Subject: |
Re: Emacs 30.0 warning from `cl-pushnew' and `memql' |
Date: |
Wed, 28 Dec 2022 14:19:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
tomas wrote:
> I see. Well, that train has sailed (or something).
> Backward compat (especially with user's brains) and things.
One can also think of `equal' for lists, instead of `eql',
as, as you know
(equal '(1 2 3) '(1 2 3)) ; t
(eql '(1 2 3) '(1 2 3)) ; nil
Here is one example of that.
;;; -*- lexical-binding: t -*-
;;
;; this file:
;; https://dataswamp.org/~incal/emacs-init/psea.el
(require 'cl-lib)
(require 'math)
(defun string-distance-percentage (str1 str2 &optional str-out)
(let*((len1 (length str1))
(len2 (length str2))
(long (max len1 len2))
(dist (string-distance str1 str2)) )
(percent (- long dist) long str-out) ))
(defun pattern-search (str &optional beg end)
(interactive `(,(read-string "search: ")
,@(when (use-region-p)
(list (region-beginning) (region-end)) )))
(or beg (setq beg (point-min)))
(or end (setq end (point-max)))
(cl-loop
with len = (length str)
for c from beg to (- end len)
with hit
with fallout
do (setq hit (buffer-substring-no-properties c (+ c len)))
(cl-pushnew (list hit
(string-distance hit str)
(string-distance-percentage str hit t) )
fallout :test #'equal)
finally return
(message "%s"
(seq-take (sort fallout (lambda (a b) (< (cadr a) (cadr b)))) 5) )))
(defalias 'psea #'pattern-search)
;; (psea "history" (point-min) (+ 100 (point-min)))
;;
;; his fil 4 42.9%
;; amp.org 5 28.6%
;; this fi 5 28.6%
;; /psea.e 6 14.3%
;; nit/pse 6 14.3%
--
underground experts united
https://dataswamp.org/~incal
- Re: Emacs 30.0 warning from `cl-pushnew' and `memql', (continued)
- Re: Emacs 30.0 warning from `cl-pushnew' and `memql', tomas, 2022/12/28
- Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Michael Heerdegen, 2022/12/28
- Re: Emacs 30.0 warning from `cl-pushnew' and `memql', tomas, 2022/12/28
- RE: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Drew Adams, 2022/12/28
- Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Stefan Monnier, 2022/12/28
- RE: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Drew Adams, 2022/12/28
- Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', tomas, 2022/12/28
- Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Emanuel Berg, 2022/12/29
- Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Emanuel Berg, 2022/12/29
- Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Emanuel Berg, 2022/12/29
- Re: Emacs 30.0 warning from `cl-pushnew' and `memql',
Emanuel Berg <=
- Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Emanuel Berg, 2022/12/29
- Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Stefan Monnier, 2022/12/29
- RE: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Drew Adams, 2022/12/28
- Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Stefan Monnier, 2022/12/28
- RE: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Drew Adams, 2022/12/28
- Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Stefan Monnier, 2022/12/28
- RE: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Drew Adams, 2022/12/29
- Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Stefan Monnier, 2022/12/29
- RE: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Drew Adams, 2022/12/29
- Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql', Stefan Monnier, 2022/12/29