Merge remote-tracking branch 'origin/master' into feature/android
This commit is contained in:
commit
2867f62484
21 changed files with 336 additions and 87 deletions
19
etc/NEWS
19
etc/NEWS
|
@ -180,6 +180,25 @@ whereas if the mouse pointer is in the left half of a glyph, point
|
|||
will be put in front the buffer position corresponding to that glyph.
|
||||
By default this is disabled.
|
||||
|
||||
** Internationalization
|
||||
|
||||
---
|
||||
*** Users in CJK locales can control width of some non-CJK characters.
|
||||
Some characters are considered by Unicode as "ambiguous" with respect
|
||||
to their display width: either "full-width" (i.e. taking 2 columns on
|
||||
display) or "narrow" (taking 1 column). The actual width depends on
|
||||
the fonts used for these characters by Emacs or (for text-mode frames)
|
||||
by the terminal emulator. Traditionally, font sets in CJK locales
|
||||
were set up so as to display these characters as full-width, and thus
|
||||
Emacs modified the char-width table in those locales to follow suit.
|
||||
Lately, the tendency is to display these characters as narrow. The
|
||||
new user option 'cjk-ambiguous-chars-are-wide' allows users to control
|
||||
whether Emacs considers these characters as full-width (the default)
|
||||
or narrow (if the variable is customized to the nil value).
|
||||
|
||||
This setting affects the results of 'string-width' and similar
|
||||
functions in CJK locales.
|
||||
|
||||
|
||||
* Changes in Specialized Modes and Packages in Emacs 30.1
|
||||
|
||||
|
|
|
@ -449,7 +449,7 @@ Keymap to display on minor modes.")
|
|||
|
||||
(defvar mode-line-modes
|
||||
(let ((recursive-edit-help-echo
|
||||
"Recursive edit, type M-C-c to get out"))
|
||||
"Recursive edit, type C-M-c to get out"))
|
||||
(list (propertize "%[" 'help-echo recursive-edit-help-echo)
|
||||
"("
|
||||
`(:propertize ("" mode-name)
|
||||
|
|
|
@ -346,7 +346,7 @@ with the buffer narrowed to the listing."
|
|||
:type 'boolean)
|
||||
|
||||
(defcustom dired-initial-position-hook nil
|
||||
"This hook is used to position the point.
|
||||
"Hook used to position point in a new Dired listing display.
|
||||
It is run by the function `dired-initial-position'."
|
||||
:group 'dired
|
||||
:type 'hook
|
||||
|
@ -3557,9 +3557,9 @@ as returned by `dired-get-filename'. LIMIT is the search limit."
|
|||
|
||||
;; FIXME document whatever dired-x is doing.
|
||||
(defun dired-initial-position (dirname)
|
||||
"Where point should go in a new listing of DIRNAME.
|
||||
Point is assumed to be at the beginning of new subdir line.
|
||||
It runs the hook `dired-initial-position-hook'."
|
||||
"Return position of point in a new listing of DIRNAME.
|
||||
Point is assumed to be at the beginning of a new subdir line.
|
||||
Runs the hook `dired-initial-position-hook'."
|
||||
(end-of-line)
|
||||
(and (featurep 'dired-x) dired-find-subdir
|
||||
(dired-goto-subdir dirname))
|
||||
|
|
|
@ -431,7 +431,8 @@ don't include."
|
|||
;; have an autoload cookie on the first column of a
|
||||
;; doc string or the like. (The Emacs tree
|
||||
;; shouldn't contain any such instances.)
|
||||
(not (ppss-string-terminator (syntax-ppss))))
|
||||
(not (ppss-string-terminator
|
||||
(save-match-data (syntax-ppss)))))
|
||||
;; ... and if we have one of these names, then alter outfile.
|
||||
(let* ((aname (match-string 2))
|
||||
(to-file (if aname
|
||||
|
|
|
@ -534,7 +534,7 @@ See also `eshell-read-history'."
|
|||
(forward-line 3)
|
||||
(while (search-backward "completion" nil 'move)
|
||||
(replace-match "history reference")))
|
||||
(eshell-redisplay)
|
||||
(redisplay)
|
||||
(message "Hit space to flush")
|
||||
(let ((ch (read-event)))
|
||||
(if (eq ch ?\ )
|
||||
|
|
|
@ -214,7 +214,7 @@ The options are `begin', `after' or `end'."
|
|||
0 frame)
|
||||
(if affected
|
||||
(let (window-scroll-functions) ;;FIXME: Why?
|
||||
(eshell-redisplay)))))
|
||||
(redisplay)))))
|
||||
|
||||
(defun eshell-smart-display-setup ()
|
||||
"Set the point to somewhere in the beginning of the last command."
|
||||
|
@ -261,7 +261,7 @@ and the end of the buffer are still visible."
|
|||
(recenter -1)
|
||||
;; trigger the redisplay now, so that we catch any attempted
|
||||
;; point motion; this is to cover for a redisplay bug
|
||||
(eshell-redisplay))
|
||||
(redisplay))
|
||||
(let ((top-point (point)))
|
||||
(and (memq 'eshell-smart-display-move pre-command-hook)
|
||||
(>= (point) eshell-last-input-start)
|
||||
|
|
|
@ -433,37 +433,21 @@ Prepend remote identification of `default-directory', if any."
|
|||
(defun eshell-printable-size (filesize &optional human-readable
|
||||
block-size use-colors)
|
||||
"Return a printable FILESIZE."
|
||||
(when (and human-readable
|
||||
(not (= human-readable 1000))
|
||||
(not (= human-readable 1024)))
|
||||
(error "human-readable must be 1000 or 1024"))
|
||||
(let ((size (float (or filesize 0))))
|
||||
(if human-readable
|
||||
(if (< size human-readable)
|
||||
(if (= (round size) 0)
|
||||
"0"
|
||||
(if block-size
|
||||
"1.0k"
|
||||
(format "%.0f" size)))
|
||||
(setq size (/ size human-readable))
|
||||
(if (< size human-readable)
|
||||
(if (<= size 9.94)
|
||||
(format "%.1fk" size)
|
||||
(format "%.0fk" size))
|
||||
(setq size (/ size human-readable))
|
||||
(if (< size human-readable)
|
||||
(let ((str (if (<= size 9.94)
|
||||
(format "%.1fM" size)
|
||||
(format "%.0fM" size))))
|
||||
(if use-colors
|
||||
(put-text-property 0 (length str)
|
||||
'face 'bold str))
|
||||
str)
|
||||
(setq size (/ size human-readable))
|
||||
(if (< size human-readable)
|
||||
(let ((str (if (<= size 9.94)
|
||||
(format "%.1fG" size)
|
||||
(format "%.0fG" size))))
|
||||
(if use-colors
|
||||
(put-text-property 0 (length str)
|
||||
'face 'bold-italic str))
|
||||
str)))))
|
||||
(let* ((flavor (and (= human-readable 1000) 'si))
|
||||
(str (file-size-human-readable size flavor)))
|
||||
(if (not use-colors)
|
||||
str
|
||||
(cond ((> size (expt human-readable 3))
|
||||
(propertize str 'face 'bold-italic))
|
||||
((> size (expt human-readable 2))
|
||||
(propertize str 'face 'bold))
|
||||
(t str))))
|
||||
(if block-size
|
||||
(setq size (/ size block-size)))
|
||||
(format "%.0f" size))))
|
||||
|
@ -492,16 +476,6 @@ list."
|
|||
(cadr flist)
|
||||
(cdr flist))))
|
||||
|
||||
(defsubst eshell-redisplay ()
|
||||
"Allow Emacs to redisplay buffers."
|
||||
;; for some strange reason, Emacs 21 is prone to trigger an
|
||||
;; "args out of range" error in `sit-for', if this function
|
||||
;; runs while point is in the minibuffer and the users attempt
|
||||
;; to use completion. Don't ask me.
|
||||
(condition-case nil
|
||||
(sit-for 0)
|
||||
(error nil)))
|
||||
|
||||
(defun eshell-user-login-name ()
|
||||
"Return the connection-aware value of the user's login name.
|
||||
See also `user-login-name'."
|
||||
|
@ -628,8 +602,6 @@ See also `user-login-name'."
|
|||
(setq host-users (cdr host-users))
|
||||
(cdr (assoc user host-users))))))
|
||||
|
||||
(autoload 'parse-time-string "parse-time")
|
||||
|
||||
(eval-when-compile
|
||||
(require 'ange-ftp)) ; ange-ftp-parse-filename
|
||||
|
||||
|
@ -813,6 +785,8 @@ If N or M is nil, it means the end of the list."
|
|||
(declare (obsolete seq-subseq "28.1"))
|
||||
(seq-subseq l n (1+ m)))
|
||||
|
||||
(define-obsolete-function-alias 'eshell-redisplay #'redisplay "30.1")
|
||||
|
||||
(provide 'esh-util)
|
||||
|
||||
;;; esh-util.el ends here
|
||||
|
|
|
@ -1905,8 +1905,8 @@ when using per-directory thumbnail file storage"))
|
|||
(if (file-exists-p image-dired-gallery-dir)
|
||||
(if (not (file-directory-p image-dired-gallery-dir))
|
||||
(error "Variable image-dired-gallery-dir is not a directory"))
|
||||
;; FIXME: Should we set umask to 077 here, as we do for thumbnails?
|
||||
(make-directory image-dired-gallery-dir))
|
||||
(with-file-modes #o700
|
||||
(make-directory image-dired-gallery-dir)))
|
||||
;; Open index file
|
||||
(with-temp-file index-file
|
||||
(if (file-exists-p index-file)
|
||||
|
|
|
@ -1394,6 +1394,174 @@ with L, LRE, or LRO Unicode bidi character type.")
|
|||
(dolist (elt l)
|
||||
(set-char-table-range char-width-table elt 2)))
|
||||
|
||||
;; A: East Asian "Ambiguous" characters.
|
||||
(let ((l '((#x00A1 . #x00A1)
|
||||
(#x00A4 . #x00A4)
|
||||
(#x00A7 . #x00A8)
|
||||
(#x00AA . #x00AA)
|
||||
(#x00AD . #x00AE)
|
||||
(#x00B0 . #x00B4)
|
||||
(#x00B6 . #x00BA)
|
||||
(#x00BC . #x00BF)
|
||||
(#x00C6 . #x00C6)
|
||||
(#x00D0 . #x00D0)
|
||||
(#x00D7 . #x00D8)
|
||||
(#x00E0 . #x00E1)
|
||||
(#x00E6 . #x00E6)
|
||||
(#x00E8 . #x00EA)
|
||||
(#x00EC . #x00ED)
|
||||
(#x00F0 . #x00F0)
|
||||
(#x00F2 . #x00F3)
|
||||
(#x00F7 . #x00FA)
|
||||
(#x00FC . #x00FC)
|
||||
(#x00FE . #x00FE)
|
||||
(#x0101 . #x0101)
|
||||
(#x0111 . #x0111)
|
||||
(#x0113 . #x0113)
|
||||
(#x011B . #x011B)
|
||||
(#x0126 . #x0127)
|
||||
(#x012B . #x012B)
|
||||
(#x0131 . #x0133)
|
||||
(#x0138 . #x0138)
|
||||
(#x013F . #x0142)
|
||||
(#x0144 . #x0144)
|
||||
(#x0148 . #x014B)
|
||||
(#x014D . #x014D)
|
||||
(#x0152 . #x0153)
|
||||
(#x0166 . #x0167)
|
||||
(#x016B . #x016B)
|
||||
(#x01CE . #x01CE)
|
||||
(#x01D0 . #x01D0)
|
||||
(#x01D2 . #x01D2)
|
||||
(#x01D4 . #x01D4)
|
||||
(#x01D6 . #x01D6)
|
||||
(#x01D8 . #x01D8)
|
||||
(#x01DA . #x01DA)
|
||||
(#x01DC . #x01DC)
|
||||
(#x0251 . #x0251)
|
||||
(#x0261 . #x0261)
|
||||
(#x02C4 . #x02C4)
|
||||
(#x02C7 . #x02C7)
|
||||
(#x02C9 . #x02CB)
|
||||
(#x02CD . #x02CD)
|
||||
(#x02D0 . #x02D0)
|
||||
(#x02D8 . #x02DB)
|
||||
(#x02DD . #x02DD)
|
||||
(#x02DF . #x02DF)
|
||||
(#x0300 . #x036F)
|
||||
(#x0391 . #x03A1)
|
||||
(#x03A3 . #x03A9)
|
||||
(#x03B1 . #x03C1)
|
||||
(#x03C3 . #x03C9)
|
||||
(#x0401 . #x0401)
|
||||
(#x0410 . #x044F)
|
||||
(#x0451 . #x0451)
|
||||
(#x2010 . #x2010)
|
||||
(#x2013 . #x2016)
|
||||
(#x2018 . #x2019)
|
||||
(#x201C . #x201D)
|
||||
(#x2020 . #x2022)
|
||||
(#x2024 . #x2027)
|
||||
(#x2030 . #x2030)
|
||||
(#x2032 . #x2033)
|
||||
(#x2035 . #x2035)
|
||||
(#x203E . #x203E)
|
||||
(#x2074 . #x2074)
|
||||
(#x207F . #x207F)
|
||||
(#x2081 . #x2084)
|
||||
(#x20AC . #x20AC)
|
||||
(#x2103 . #x2103)
|
||||
(#x2105 . #x2105)
|
||||
(#x2109 . #x2109)
|
||||
(#x2113 . #x2113)
|
||||
(#x2116 . #x2116)
|
||||
(#x2121 . #x2122)
|
||||
(#x2126 . #x2126)
|
||||
(#x212B . #x212B)
|
||||
(#x2153 . #x2154)
|
||||
(#x215B . #x215E)
|
||||
(#x2160 . #x216B)
|
||||
(#x2170 . #x2179)
|
||||
(#x2189 . #x2189)
|
||||
(#x2190 . #x2199)
|
||||
(#x21B8 . #x21B9)
|
||||
(#x21D2 . #x21D2)
|
||||
(#x21D4 . #x21D4)
|
||||
(#x21E7 . #x21E7)
|
||||
(#x2200 . #x2200)
|
||||
(#x2202 . #x2203)
|
||||
(#x2207 . #x2208)
|
||||
(#x220B . #x220B)
|
||||
(#x220F . #x220F)
|
||||
(#x2211 . #x2211)
|
||||
(#x2215 . #x2215)
|
||||
(#x221A . #x221A)
|
||||
(#x221D . #x2220)
|
||||
(#x2223 . #x2223)
|
||||
(#x2225 . #x2225)
|
||||
(#x2227 . #x222C)
|
||||
(#x222E . #x222E)
|
||||
(#x2234 . #x2237)
|
||||
(#x223C . #x223D)
|
||||
(#x2248 . #x2248)
|
||||
(#x224C . #x224C)
|
||||
(#x2252 . #x2252)
|
||||
(#x2260 . #x2261)
|
||||
(#x2264 . #x2267)
|
||||
(#x226A . #x226B)
|
||||
(#x226E . #x226F)
|
||||
(#x2282 . #x2283)
|
||||
(#x2286 . #x2287)
|
||||
(#x2295 . #x2295)
|
||||
(#x2299 . #x2299)
|
||||
(#x22A5 . #x22A5)
|
||||
(#x22BF . #x22BF)
|
||||
(#x2312 . #x2312)
|
||||
(#x2460 . #x24E9)
|
||||
(#x24EB . #x254B)
|
||||
(#x2550 . #x2573)
|
||||
(#x2580 . #x258F)
|
||||
(#x2592 . #x2595)
|
||||
(#x25A0 . #x25A1)
|
||||
(#x25A3 . #x25A9)
|
||||
(#x25B2 . #x25B3)
|
||||
(#x25B6 . #x25B7)
|
||||
(#x25BC . #x25BD)
|
||||
(#x25C0 . #x25C1)
|
||||
(#x25C6 . #x25C8)
|
||||
(#x25CE . #x25D1)
|
||||
(#x25E2 . #x25E5)
|
||||
(#x25EF . #x25EF)
|
||||
(#x2605 . #x2606)
|
||||
(#x260E . #x260F)
|
||||
(#x261C . #x261C)
|
||||
(#x261E . #x261E)
|
||||
(#x2640 . #x2640)
|
||||
(#x2642 . #x2642)
|
||||
(#x2660 . #x2661)
|
||||
(#x2663 . #x2665)
|
||||
(#x2667 . #x266A)
|
||||
(#x266C . #x266D)
|
||||
(#x266F . #x266F)
|
||||
(#x269E . #x269F)
|
||||
(#x26BF . #x26BF)
|
||||
(#x26C6 . #x26CD)
|
||||
(#x26CF . #x26D3)
|
||||
(#x26D5 . #x26E1)
|
||||
(#x26E3 . #x26E3)
|
||||
(#x26E8 . #x26E9)
|
||||
(#x26EB . #x26F1)
|
||||
(#x26F4 . #x26F4)
|
||||
(#x26F6 . #x26F9)
|
||||
(#x26FB . #x26FC)
|
||||
(#x26FE . #x26FF)
|
||||
(#x273D . #x273D)
|
||||
(#x2776 . #x277F)
|
||||
(#x2B56 . #x2B59)
|
||||
(#x3248 . #x324F))))
|
||||
(dolist (elt l)
|
||||
(set-char-table-range ambiguous-width-chars elt t)))
|
||||
|
||||
;; Other double width
|
||||
;;(map-charset-chars
|
||||
;; (lambda (range ignore) (set-char-table-range char-width-table range 2))
|
||||
|
@ -1427,6 +1595,45 @@ with L, LRE, or LRO Unicode bidi character type.")
|
|||
(chinese-cns11643-1 (#x2121 . #x427E)))
|
||||
(ko_KR nil (korean-ksc5601 (#x2121 . #x2C7E)))))
|
||||
|
||||
(defun update-cjk-ambiguous-char-widths (locale-name)
|
||||
"Update character widths for LOCALE-NAME using `ambiguous-width-chars'.
|
||||
LOCALE-NAME is the symbol of a CJK locale, such as \\='zh_CN."
|
||||
(let ((slot (assq locale-name cjk-char-width-table-list)))
|
||||
(or slot (error "Unknown locale for CJK language environment: %s"
|
||||
locale-name))
|
||||
;; Force recomputation of child table in 'use-cjk-char-width-table'.
|
||||
(setcar (cdr slot) nil)
|
||||
(use-cjk-char-width-table locale-name)))
|
||||
|
||||
|
||||
(defcustom cjk-ambiguous-chars-are-wide t
|
||||
"Whether the \"ambiguous-width\" characters take 2 columns on display.
|
||||
|
||||
Some of the characters are defined by Unicode as being of \"ambiguous\"
|
||||
width: the actual width, either 1 column or 2 columns, should be
|
||||
determined at display time, depending on the language context.
|
||||
If this variable is non-nil, Emacs will consider these characters as
|
||||
full-width, i.e. taking 2 columns; otherwise they are narrow characters
|
||||
taking 1 column on display. Which value is correct depends on the
|
||||
fonts being used. In some CJK locales the fonts are set so that
|
||||
these characters are displayed as full-width. This setting is most
|
||||
important for text-mode frames, because there Emacs cannot access the
|
||||
metrics of the fonts used by the console or the terminal emulator.
|
||||
|
||||
Do not set this directly via `setq'; instead, use `setopt' or the
|
||||
Customize commands. Alternatively, call `update-cjk-ambiguous-char-widths'
|
||||
passing it the symbol of the current locale environment, after changing
|
||||
the value of the variable with `setq'."
|
||||
:type 'boolean
|
||||
:set (lambda (symbol value)
|
||||
(set-default symbol value)
|
||||
(let ((locsym (get-language-info current-language-environment
|
||||
'cjk-locale-symbol)))
|
||||
(when locsym
|
||||
(update-cjk-ambiguous-char-widths locsym))))
|
||||
:version "30.1"
|
||||
:group 'display)
|
||||
|
||||
;; Internal use only.
|
||||
;; Setup char-width-table appropriate for a language environment
|
||||
;; corresponding to LOCALE-NAME (symbol).
|
||||
|
@ -1448,7 +1655,15 @@ with L, LRE, or LRO Unicode bidi character type.")
|
|||
(car code-range) (cdr code-range)))))
|
||||
(optimize-char-table table)
|
||||
(set-char-table-parent table char-width-table)
|
||||
(setcar (cdr slot) table)))
|
||||
(let ((tbl (make-char-table nil)))
|
||||
(map-char-table
|
||||
(lambda (range _val)
|
||||
(set-char-table-range tbl range
|
||||
(if cjk-ambiguous-chars-are-wide 2 1)))
|
||||
ambiguous-width-chars)
|
||||
(optimize-char-table tbl)
|
||||
(set-char-table-parent tbl table)
|
||||
(setcar (cdr slot) tbl))))
|
||||
(setq char-width-table (nth 1 slot))))
|
||||
|
||||
(defun use-default-char-width-table ()
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
(set-language-info-alist
|
||||
"Chinese-GB" '((charset chinese-gb2312 chinese-sisheng)
|
||||
(iso639-language . zh)
|
||||
(cjk-locale-symbol . zh_CN)
|
||||
(setup-function . (lambda ()
|
||||
(use-cjk-char-width-table 'zh_CN)))
|
||||
(exit-function . use-default-char-width-table)
|
||||
|
@ -142,6 +143,7 @@
|
|||
(set-language-info-alist
|
||||
"Chinese-BIG5" '((charset chinese-big5-1 chinese-big5-2)
|
||||
(iso639-language . zh)
|
||||
(cjk-locale-symbol . zh_HK)
|
||||
(setup-function . (lambda ()
|
||||
(use-cjk-char-width-table 'zh_HK)))
|
||||
(exit-function . use-default-char-width-table)
|
||||
|
@ -198,6 +200,7 @@
|
|||
chinese-cns11643-5 chinese-cns11643-6
|
||||
chinese-cns11643-7)
|
||||
(iso639-language . zh)
|
||||
(cjk-locale-symbol . zh_TW)
|
||||
(setup-function . (lambda ()
|
||||
(use-cjk-char-width-table 'zh_TW)))
|
||||
(exit-function . use-default-char-width-table)
|
||||
|
@ -218,6 +221,7 @@ accepts Big5 for input also (which is then converted to CNS)."))
|
|||
chinese-cns11643-5 chinese-cns11643-6
|
||||
chinese-cns11643-7 chinese-big5-1 chinese-big5-2)
|
||||
(iso639-language . zh)
|
||||
(cjk-locale-symbol . zh_TW)
|
||||
(setup-function . (lambda ()
|
||||
(use-cjk-char-width-table 'zh_TW)))
|
||||
(exit-function . use-default-char-width-table)
|
||||
|
@ -248,6 +252,7 @@ converted to CNS)."))
|
|||
(set-language-info-alist
|
||||
"Chinese-GBK" '((charset chinese-gbk)
|
||||
(iso639-language . zh)
|
||||
(cjk-locale-symbol . zh_CN)
|
||||
(setup-function . (lambda ()
|
||||
(use-cjk-char-width-table 'zh_CN)))
|
||||
(exit-function . use-default-char-width-table)
|
||||
|
|
|
@ -208,6 +208,7 @@ eucJP-ms is defined in <http://www.opengroup.or.jp/jvc/cde/appendix.html>."
|
|||
"Japanese" '((setup-function . setup-japanese-environment-internal)
|
||||
(exit-function . use-default-char-width-table)
|
||||
(iso639-language . ja)
|
||||
(cjk-locale-symbol . ja_JP)
|
||||
(tutorial . "TUTORIAL.ja")
|
||||
(charset japanese-jisx0208
|
||||
japanese-jisx0212 latin-jisx0201 katakana-jisx0201
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
(set-language-info-alist
|
||||
"Korean" '((setup-function . setup-korean-environment-internal)
|
||||
(exit-function . exit-korean-environment)
|
||||
(cjk-locale-symbol . ko_KR)
|
||||
(iso639-language . ko)
|
||||
(tutorial . "TUTORIAL.ko")
|
||||
(charset korean-ksc5601 cp949)
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
|
||||
(defun rng-make-datatypes-uri (uri)
|
||||
(if (string-equal uri "")
|
||||
;; The spec doesn't say to do this, but it's perfectly conformant
|
||||
|
@ -39,26 +41,7 @@
|
|||
(defun rng-substq (new old list)
|
||||
"Replace first member of LIST (if any) that is `eq' to OLD by NEW.
|
||||
LIST is not modified."
|
||||
(cond ((null list) nil)
|
||||
((eq (car list) old)
|
||||
(cons new (cdr list)))
|
||||
(t
|
||||
(let ((tail (cons (car list)
|
||||
nil))
|
||||
(rest (cdr list)))
|
||||
(setq list tail)
|
||||
(while rest
|
||||
(let ((item (car rest)))
|
||||
(setq rest (cdr rest))
|
||||
(cond ((eq item old)
|
||||
(setcdr tail
|
||||
(cons new rest))
|
||||
(setq rest nil))
|
||||
(t
|
||||
(setq tail
|
||||
(setcdr tail
|
||||
(cons item nil))))))))
|
||||
list)))
|
||||
(cl-substitute new old list :count 1 :test #'eq))
|
||||
|
||||
(defun rng-escape-string (s)
|
||||
(replace-regexp-in-string "[&\"<>]"
|
||||
|
|
|
@ -1318,10 +1318,10 @@ If specific documentation can't be given, be generic."
|
|||
|
||||
;; general utilities
|
||||
|
||||
(defun pcomplete-uniquify-list (l)
|
||||
"Sort and remove multiples in L."
|
||||
(setq l (sort l #'string-lessp))
|
||||
(seq-uniq l))
|
||||
(defun pcomplete-uniquify-list (sequence)
|
||||
"Sort and remove multiples in SEQUENCE.
|
||||
Sequence should be a vector or list of strings."
|
||||
(sort (seq-uniq sequence) #'string-lessp))
|
||||
(define-obsolete-function-alias 'pcomplete-uniqify-list #'pcomplete-uniquify-list "27.1")
|
||||
|
||||
(defun pcomplete-process-result (cmd &rest args)
|
||||
|
|
|
@ -24,11 +24,6 @@
|
|||
|
||||
;;; Commentary:
|
||||
|
||||
;; NOTE: The project API is still experimental and can change in major,
|
||||
;; backward-incompatible ways. Everyone is encouraged to try it, and
|
||||
;; report to us any problems or use cases we hadn't anticipated, by
|
||||
;; sending an email to emacs-devel, or `M-x report-emacs-bug'.
|
||||
;;
|
||||
;; This file contains generic infrastructure for dealing with
|
||||
;; projects, some utility functions, and commands using that
|
||||
;; infrastructure.
|
||||
|
|
|
@ -49,6 +49,17 @@
|
|||
Each element looks like (FILENAME . POSITION);
|
||||
visiting file FILENAME goes automatically to position POSITION
|
||||
rather than the beginning of the buffer.
|
||||
A list element can also have the form
|
||||
|
||||
(DIRECTORY (dired-filename . FILENAME))
|
||||
|
||||
where DIRECTORY is the name of a directory ending in a slash,
|
||||
and FILENAME is the name of a file in that directory. This
|
||||
format is used for saving places in Dired buffers, see the
|
||||
function `save-place-dired-hook'; the FILENAME is the file
|
||||
where point was located in the Dired listing of DIRECTORY
|
||||
when the place in that buffer was recorded.
|
||||
|
||||
This alist is saved between Emacs sessions.")
|
||||
|
||||
(defcustom save-place-file (locate-user-emacs-file "places" ".emacs-places")
|
||||
|
@ -399,7 +410,8 @@ It runs the hook `save-place-after-find-file-hook'."
|
|||
(declare-function dired-goto-file "dired" (file))
|
||||
|
||||
(defun save-place-dired-hook ()
|
||||
"Position the point in a Dired buffer."
|
||||
"Position point in a Dired buffer according to its saved place.
|
||||
This is run via `dired-initial-position-hook', which see."
|
||||
(or save-place-loaded (save-place-load-alist-from-file))
|
||||
(when-let ((directory (and (derived-mode-p 'dired-mode)
|
||||
(boundp 'dired-subdir-alist)
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
(require 'seq)
|
||||
(require 'icons))
|
||||
|
||||
(autoload 'cl--set-substring "cl-lib")
|
||||
|
||||
|
||||
(defgroup tab-bar nil
|
||||
"Frame-local tabs."
|
||||
|
|
|
@ -1117,6 +1117,14 @@ A char-table for width (columns) of each character. */);
|
|||
char_table_set_range (Vchar_width_table, MAX_5_BYTE_CHAR + 1, MAX_CHAR,
|
||||
make_fixnum (4));
|
||||
|
||||
DEFVAR_LISP ("ambiguous-width-chars", Vambiguous_width_chars,
|
||||
doc: /*
|
||||
A char-table for characters whose width (columns) can be 1 or 2.
|
||||
|
||||
The actual width depends on the language-environment and on the
|
||||
value of `cjk-ambiguous-chars-are-wide'. */);
|
||||
Vambiguous_width_chars = Fmake_char_table (Qnil, Qnil);
|
||||
|
||||
DEFVAR_LISP ("printable-chars", Vprintable_chars,
|
||||
doc: /* A char-table for each printable character. */);
|
||||
Vprintable_chars = Fmake_char_table (Qnil, Qnil);
|
||||
|
|
|
@ -3674,7 +3674,9 @@ in the permissions of newly created files will be disabled.
|
|||
|
||||
Note that when `write-region' creates a file, it resets the
|
||||
execute bit, even if the mask set by this function allows that bit
|
||||
by having the corresponding bit in the mask reset. */)
|
||||
by having the corresponding bit in the mask reset.
|
||||
|
||||
See also `with-file-modes'. */)
|
||||
(Lisp_Object mode)
|
||||
{
|
||||
mode_t oldrealmask, oldumask, newumask;
|
||||
|
|
|
@ -17,7 +17,7 @@ Name: example from Commentary
|
|||
short foo = 2;
|
||||
double blah = 4;
|
||||
=-=
|
||||
int a = 1;
|
||||
short foo = 2;
|
||||
double blah = 4;
|
||||
int a = 1;
|
||||
short foo = 2;
|
||||
double blah = 4;
|
||||
=-=-=
|
||||
|
|
|
@ -125,4 +125,35 @@
|
|||
(should (equal (eshell-convert-to-number "123") "123"))
|
||||
(should (equal (eshell-convert-to-number "1.23") "1.23"))))
|
||||
|
||||
(ert-deftest esh-util-test/eshell-printable-size ()
|
||||
(should (equal (eshell-printable-size (expt 2 16)) "65536"))
|
||||
(should (equal (eshell-printable-size (expt 2 32)) "4294967296")))
|
||||
|
||||
(ert-deftest esh-util-test/eshell-printable-size/zero ()
|
||||
(should (equal (eshell-printable-size 0 1000 nil t) "0")))
|
||||
|
||||
(ert-deftest esh-util-test/eshell-printable-size/terabyte ()
|
||||
(should (equal (eshell-printable-size (1- (expt 2 40)) 1024 nil t) "1024G"))
|
||||
(should (equal (eshell-printable-size (expt 2 40) 1024 nil t) "1T"))
|
||||
(should (equal (eshell-printable-size (1- (expt 10 12)) 1000 nil t) "1000G"))
|
||||
(should (equal (eshell-printable-size (expt 10 12) 1000 nil t) "1T")))
|
||||
|
||||
(ert-deftest esh-util-test/eshell-printable-size/use-colors ()
|
||||
(should (equal-including-properties
|
||||
(eshell-printable-size (1- (expt 2 20)) 1024 nil t)
|
||||
"1024k"))
|
||||
(should (equal-including-properties
|
||||
(eshell-printable-size (1- (expt 2 30)) 1024 nil t)
|
||||
(propertize "1024M" 'face 'bold)))
|
||||
(should (equal-including-properties
|
||||
(eshell-printable-size (1- (expt 2 40)) 1024 nil t)
|
||||
(propertize "1024G" 'face 'bold-italic))))
|
||||
|
||||
(ert-deftest esh-util-test/eshell-printable-size/block-size ()
|
||||
(should (equal (eshell-printable-size (1- (expt 2 20)) nil 4096) "256"))
|
||||
(should (equal (eshell-printable-size (1- (expt 2 30)) nil 4096) "262144")))
|
||||
|
||||
(ert-deftest esh-util-test/eshell-printable-size/human-readable-arg ()
|
||||
(should-error (eshell-printable-size 0 999 nil t)))
|
||||
|
||||
;;; esh-util-tests.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue