bug#81489: 32.0.50; w32--terminal-is-conhost is nil in gui emacs.
TAKAHASHI Yoshio <[email protected]> Thu, 30 Jul 2026 15:40:02 +0900
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
TAKAHASHI Yoshio <[email protected]> writes: >> I wonder why this doesn't work for you during startup. Perhaps you >> could look at the relevant codes and try figuring this out? There's >> probably something I'm missing here, but what? > > These call flows are in loadup.el, and not in individual emacs startup??? This is my minunderstanding, sorry. I did "print debug" ;-) I add "!!!!!" line in function u-c-c-w-table. (defun use-cjk-char-width-table (locale-name) (print (format "use-cjk-char-width-table %s" locale-name)) ; !!!!! (print (format "cjk-ambiguous-chars-are-wide %s" cjk-ambiguous-chars-are-wide)) ; !!!!! (print (format "window-system %s" (window-system))) ; !!!!! (while (char-table-parent char-width-table) (setq char-width-table (char-table-parent char-width-table))) (let ((slot (assq locale-name cjk-char-width-table-list))) (or slot (error "Unknown locale for CJK language environment: %s" locale-name)) (print (format "slot %s" slot)) ; !!!!! (unless (nth 1 slot) (let ((table (make-char-table nil))) (dolist (charset-info (nthcdr 2 slot)) (let ((charset (car charset-info))) (dolist (code-range (cdr charset-info)) (map-charset-chars (lambda (range _arg) (set-char-table-range table range 2)) charset nil (car code-range) (cdr code-range))))) (optimize-char-table table) (set-char-table-parent table char-width-table) (let ((tbl (make-char-table nil)) (ambiguous-is-wide (and cjk-ambiguous-chars-are-wide ;; MS-Windows Terminal forces all ambiguous ;; characters to be narrow, even in CJK locales. (not (and (null (window-system)) (boundp 'w32--terminal-is-conhost) (null w32--terminal-is-conhost)))))) (print (format "ambiguous-is-wide %s" ambiguous-is-wide)) ; !!!!! (map-char-table (lambda (range _val) (set-char-table-range tbl range (if ambiguous-is-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)))) emacs -Q -l ./a.el *scrach* buffer is --8<---------------cut here---------------start------------->8--- "use-cjk-char-width-table ja_JP" "cjk-ambiguous-chars-are-wide t" "window-system nil" "slot (ja_JP nil (japanese-jisx0208 (8481 . 10366)) (cp932-2-byte (33088 . 34719)))" "ambiguous-is-wide nil" For information about GNU Emacs and the GNU system, type C-h C-a. "use-cjk-char-width-table ja_JP" "cjk-ambiguous-chars-are-wide t" "window-system w32" "slot (ja_JP #^[...] (japanese-jisx0208 (8481 . 10366)) (cp932-2-byte (33088 . 34719)))" nil 5 5 --8<---------------cut here---------------end--------------->8--- #[...] is delete by hand. (nth 1 slot) is not NIL, a vector, then char table is not regenerated, the "ambiguous-is-wide nil" table that is generated during startup is continued to be used. a.el --8<---------------cut here---------------start------------->8--- (set-language-environment "English") (set-language-environment "Japanese") (set-face-attribute 'default nil :family "MS Gothic" :height 160) (when (boundp 'w32--terminal-is-conhost) (print w32--terminal-is-conhost)) (with-temp-buffer (insert "") (newline) (insert "") (newline) (goto-char (point-min)) (end-of-line) (print (current-column)) (next-line) (end-of-line) (print (current-column))) --8<---------------cut here---------------end--------------->8--- -- TAKAHASHI Yoshio <[email protected]>