Project

General

Profile

Bug #1412

Emacs UI: font size

Added by John Abbott about 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
EmacsUI
Target version:
Start date:
05 Feb 2020
Due date:
% Done:

100%

Estimated time:
3.55 h
Spent time:

Description

With my emacs (ver. 25) I can increase the size of the font using C-x C-+.
This also works for a *cocoa5* comint buffer... until I send a command to be executed, when the size immediately reverts to normal (not helpful when giving a demo).

Find out how to preserve the chosen "magnification".


Related issues

Related to CoCoA-5 - Feature #1358: Emacs UI: should active input line be cleared before sending line from CoCoA-5 file?Closed2019-10-30

Related to CoCoA-5 - Design #1432: Emacs UI: cocoa5-shell-check-process vs. process-statusNew2020-03-03

History

#1 Updated by Anna Maria Bigatti about 4 years ago

On my computer it keeps the big fonts.
Both on emacs-24 and emacs-26.

#2 Updated by John Abbott about 4 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10
An important clarification:
  • if I send a line to CoCoA-5 then the magnification remains unaffected
  • if I do SourceRegion or source then the magnification is "forgotten"

#3 Updated by Anna Maria Bigatti about 4 years ago

same here!

#4 Updated by John Abbott about 4 years ago

  • Related to Feature #1358: Emacs UI: should active input line be cleared before sending line from CoCoA-5 file? added

#5 Updated by John Abbott about 4 years ago

See comment 6 in issue #1358. I think it might be relevant here.

#6 Updated by John Abbott about 4 years ago

Increased font size was forgotten when:
  • had a *cocoa* buffer with no process, and then sent a single line (C-RET)
Increased font size preserved when:
  • had a *cocoa* buffer with process, and then sent a single line (C-RET)
Increased font size was forgotten when:
  • had a *cocoa* buffer with process, and then sent a single long line (C-RET); actually sent via cocoa5-send-region.

#7 Updated by John Abbott about 4 years ago

Clue city!

In cocoa5.el near line 1743 in the fn defn for cocoa5-send-region,
I commented out the command (if (not (eq (process-status "cocoa5") "run")) (cocoa5-make-shell))
Now "send region" seems to preserve the font size!

#8 Updated by John Abbott about 4 years ago

  • % Done changed from 10 to 20

I had a quick look online for hints about increased font sizes...

  • the emacs function which changes the font size is text-scale-adjust; it automatically activates the minor mode text-scale-mode
  • typing M-x cocoa5 RET also causes the magnification to be forgotten

I am guessing that somewhere the minor mode becomes forgotten (e.g. by forcing the mode to be cocoa-comint?)

#9 Updated by John Abbott about 4 years ago

  • Related to Design #1432: Emacs UI: cocoa5-shell-check-process vs. process-status added

#10 Updated by John Abbott about 4 years ago

I have made some improvement. Now "send region" should keep the font magnification.

M-x cocoa5 definitely forgets the magnification; this is also implicitly called by "send region" (and other "send" commands) if CoCoA-5 is no longer running. No idea how to fix this...

#11 Updated by John Abbott about 4 years ago

  • Status changed from In Progress to Resolved
  • Assignee set to John Abbott
  • % Done changed from 20 to 70

I have found one bug/slug... The emacs fn process-status returns a symbol, not a string; so all the previous tests to see whether the result was the string "run" always returned false (well, nil), so that cocoa5-make-shell was always called (and this always clobbered the minor mode).

Anyway, now send-line, source-region and source-file should all preserve the magnification (so long as the process is still running).

Since I have been "hacking" the code blind (i.e. without really understanding what it is doing), I am not so sure that it will always the work the way I hope...

#12 Updated by John Abbott almost 4 years ago

See also https://stackoverflow.com/questions/2238418/emacs-lisp-how-to-get-buffer-major-mode

Emacs BUG: It seems that emacs forgets the text-scale-adjust if I reawaken my conmputer from sleep.

#13 Updated by Anna Maria Bigatti over 3 years ago

John Abbott wrote:

I have made some improvement. Now "send region" should keep the font magnification.

I confirm (emacs 26)

M-x cocoa5 definitely forgets the magnification; this is also implicitly called by "send region" (and other "send" commands) if CoCoA-5 is no longer running. No idea how to fix this...

I think this should be another issue. Close this one?

#14 Updated by John Abbott over 2 years ago

A quick search produced the following advice:

https://stackoverflow.com/questions/2238418/emacs-lisp-how-to-get-buffer-major-mode

The idea is to check whether there major mode is already cocoa5 (or whatever it should be), and set it only if not;
the following reportedly finds the major mode... (not yet tried)

(buffer-local-value 'major-mode (get-buffer "*scratch*"))

Buffer *cocoa5* should have major mode cocoa5-comint-mode

#15 Updated by John Abbott over 2 years ago

I think the relevant line is 1337 in cocoa5.el... too tired to try now.

#16 Updated by John Abbott over 2 years ago

  • Status changed from Resolved to Feedback
  • % Done changed from 70 to 90

I have just checked in a modified version of cocoa5.el.
I have replaced line 1337 by an if which sets the major mode only if the major is not already cocoa5-comint-mode.
Some initial tests passed fine :-)
Moving to feedback... this really needs to be tested (since I am not sue whether my change is good)

#17 Updated by John Abbott over 2 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100
  • Estimated time set to 3.55 h

Also available in: Atom PDF