emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-28 a866674b2a: Fix inaccuracies in "lax search" documentation


From: Robert Pluim
Subject: Re: emacs-28 a866674b2a: Fix inaccuracies in "lax search" documentation
Date: Tue, 26 Jul 2022 09:59:07 +0200

>>>>> On Mon, 25 Jul 2022 22:49:11 +0300, Juri Linkov <juri@linkov.net> said:

    >>>> > Should we make `char-fold-to-regexp' into a command and refer to it
    >>>> > from here? Or add something like `char-fold-show-equivalences'?
    >>>> 
    >>>> A better name would be `describe-char-fold'.
    >>> 
    >>> For a command, I'd say describe-character-foldings.  But
    >>> char-fold-show-equivalences is IMO a better name.
    >> 
    >> All similar commands have names starting with the `describe-' prefix like
    >> `describe-char', `describe-character-set'.  So maybe then
    >> `describe-char-fold-equivalences'.

    Juri> Ok, then let's use describe-char-fold-equivalences:

Ah, that lists *all* the equivalences. I was thinking more along the
lines of the following (we can give it a different name, or combine them)

(defun char-fold-char-equivalences (char &optional lax)
  "Display characters equivalent to CHAR.
Prompt for CHAR.  Interactively, a prefix arg means also include
any ligatures that CHAR partially matches."
  (interactive (list (read-char-by-name "Character (Unicode name or hex): ")
                     current-prefix-arg))
  (require 'help-fns)
  (let ((help-buffer-under-preparation t))
    (help-setup-xref (list #'describe-char-fold-equivalences)
                     (called-interactively-p 'interactive))
    (let* ((equivalences nil)
           (char-fold--no-regexp t)
           (table (char-fold--make-table))
           (extra (aref (char-table-extra-slot table 0) char)))
      (setq equivalences (aref table char))
      (when lax
        (setq equivalences (append equivalences
                                 (mapcar (lambda (entry)
                                           (cdr entry))
                                         extra))))
      (setq equivalences (cons (char-to-string char) equivalences))
      (with-help-window (help-buffer)
        (with-current-buffer standard-output
          (insert (mapconcat
                   (lambda (c)
                     (format "%s: \?\\N{%s}\n"
                             c
                             (or (get-char-code-property (string-to-char c) 
'name)
                                 (get-char-code-property (string-to-char c) 
'old-name))))
                   equivalences)))))))

Robert
-- 



reply via email to

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