unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: crstml@libero.it
To: Eli Zaretskii <eliz@gnu.org>, help-gnu-emacs@gnu.org
Subject: Re: emacs settings priority
Date: Mon, 8 Apr 2024 16:52:59 +0200	[thread overview]
Message-ID: <4f7175b5-4616-0379-f84f-818407d2d319@libero.it> (raw)
In-Reply-To: <86zfu61nmj.fsf@gnu.org>

Eli Zaretskii wrote:
>> From: crstml@libero.it
>> Date: Sat, 6 Apr 2024 14:58:57 +0200
>>
>> Eli Zaretskii wrote:
>> (custom-set-faces
>>    ;; custom-set-faces was added by Custom.
>>    ;; If you edit it by hand, you could mess it up, so be careful.
>>    ;; Your init file should contain only one such instance.
>>    ;; If there is more than one, they won't work right.
>>    '(default ((t (:inherit nil :extend nil :stipple nil :background "black" :foreground "gray" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal))))
>>    '(font-lock-builtin-face ((t (:foreground "cornflower blue"))))
>>    '(font-lock-comment-delimiter-face ((default (:inherit font-lock-comment-face)) (((class color) (min-colors 16)) nil)))
>>    '(font-lock-comment-face ((t (:foreground "red"))))
>>    '(font-lock-function-name-face ((((class color) (min-colors 88) (background dark)) (:foreground "gray" :weight bold))))
>>    '(font-lock-keyword-face ((((class color) (min-colors 88) (background dark)) (:foreground "RoyalBlue"))))
>>    '(font-lock-string-face ((((class color) (min-colors 88) (background dark)) (:foreground "orange"))))
>>    '(font-lock-type-face ((((class color) (min-colors 88) (background dark)) (:foreground "darkslategray"))))
>>    '(font-lock-variable-name-face ((t (:foreground "goldenrod"))))
>>    '(mode-line ((((class color) (min-colors 88)) (:background "orange" :foreground "black")))))
>>
>> ;;No other contents is present in this file
>> ;;
>>
>> ---- end ~/.emacs ----
>>
>> Here are the tests:
>>
>> 1) Try the following command lines:
>>
>>       emacs -fn 10x20 &
>>       emacs -fn lucidasanstypewriter-24 &
>>
>>       There is no difference between the emacs instances regarding the fonts.
>>
>> 2) Rename the .emacs to .emacs.disabled and run the same commands again.
>>
>>      mv .emacs .emacs.disabled
>>      emacs -fn 10x20 &
>>      emacs -fn lucidasanstypewriter-24 &
>>
>>      Now without the .emacs file the -fn command line option is taken
>>      into account.
> I can reproduce this only partially.  I don't have the 10x20 and
> Lucida Sans Typewritere fonts, but I do have Lucida Sans Unicode, so I
> tried
>
>    emacs -fn "Lucida Sans Unicode-24"
>
> What this did is that Emacs uses Lucida Sans Unicode font as its
> default, but does NOT use the "24" size-specification.  If I remove
> the ":height 113" part from your default-face spec in .emacs, then
> both the font and the size specified on the command line are used.
Also this one is a good test because it proves that settings in the
configuration file can interfere with what was specified in the command
line.
>>   From these tests it's obvious that -fn has lower precedence than the .emacs
>> file.
> That conclusion is generally incorrect.  There's no "precedence" here.
> The command-line options are processed _after_ the .emacs file, but if
> you specify overlapping settings, what happens when the command line
> is processed depends on what exactly you specified.  In this case, you
> specified the size in .emacs and font plus size on the command line,
> and what happens as result is subject to the Emacs logic of merging
> overlapping font specifications.
This is valuable information.
>
>> It turns that probably I always need to specify an init file in the
>> command line when I start emacs (if sometimes I want a different behavior).
> Any reason why you specify the font size both on the command line and
> in the init file?
Not any very special reason. However, here is my usecase: I use emacs daily and I have a
init file that I use since years. Now, I need in certain circumstances to start an emacs
instance from a script with some different faces (different background color and font
size) than those in the configuration file. Trying to do it provided "no results"... due
to the reasons you have mentioned above.

>
>> Not that it's impossible or difficult. But I had to do some experiments to
>> understand what is going on and in the end I was interested if this stuff
>> is documented probably with some advice/best practices about how the users
>> should set up their environments.
> The best advice and practice I can recommend is never to specify
> overlapping or contradicting settings.  Then you will not need to
> wonder which one takes precedence and what will be the result.  Take
> it from someone who uses Emacs for the past 30+ years.
>
Good to know. In this case I think that probably the best solution for my case
would be to start emacs with a different init file.

Thank you for your advice
Cristian








  reply	other threads:[~2024-04-08 14:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  7:17 emacs settings priority crstml
2024-04-05 12:10 ` Eli Zaretskii
2024-04-05 16:07   ` crstml
2024-04-05 17:14     ` Eli Zaretskii
2024-04-06 12:58       ` crstml
2024-04-06 16:07         ` Eli Zaretskii
2024-04-08 14:52           ` crstml [this message]
2024-04-06 17:55         ` tpeplt
2024-04-06 18:17           ` tpeplt
2024-04-08 14:58             ` crstml

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f7175b5-4616-0379-f84f-818407d2d319@libero.it \
    --to=crstml@libero.it \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).