help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: help: how to load existing file after upgrading to Emacs 29.1 from 2


From: Globe Trotter
Subject: Re: help: how to load existing file after upgrading to Emacs 29.1 from 28.3, or save it without prompt
Date: Sun, 12 Nov 2023 17:39:15 +0000 (UTC)

On Sunday, November 12, 2023 at 10:46:06 AM CST, Eli Zaretskii <eliz@gnu.org> 
wrote: 





> Date: Sun, 12 Nov 2023 15:30:39 +0000 (UTC)

> From: Globe Trotter <itsme_410@yahoo.com>
> 
> I am a long-term emacs user (for 31 years) but I have a strange problem since 
> my recent upgrade to 29.1 (as part of my Fedora distribution upgrade from 38 
> to 39).
> 
> 
> I try:
> 
> $ emacs test.txt
> 
> And I get a window that simply loads the following:
> 
> https://i.stack.imgur.com/ecDDL.png


> Chrystal ball says something is wrong with your customizations.  Try

>  $ emacs -Q test.txt

> nstead.  If that behaves as you are used to, then look into your init
> file(s) for the culprit(s).


Hi,

Thanks for this! Yes, this loads the existing file, however it does not load my 
default font (size is too  small).

Init files: I have a .emacs file, but I do not have a init.el file. What should 
I be looking at?

Here is my .emacs file. What should I be 



;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;; (package-initialize)
(setq load-path (append load-path (list "~/lisp")))

;; Startup settings for ESS (this is borrowed from VM)
;;
;; For some reason, native compilation breaks VM. As a workaround until the
;; problem is understood and fixed, disable native compilation of all VM
;; lisp files.
;; (eval-after-load "comp"
;;'(if (boundp 'native-comp-deferred-compilation-deny-list)
;;     (add-to-list 'native-comp-deferred-compilation-deny-list "*/ess\*.el"))

(setq TeX-default-mode 'latex-mode)
(setq text-mode-hook '(lambda ()
            (auto-fill-mode 1)(abbrev-mode 1)
            ))
(define-key esc-map "#" 'goto-line)
(setq default-major-mode 'text-mode)
(setq auto-save-interval 1000)
(setq ask-about-buffer-names t)
(defun rec0() (interactive)(recenter 0))
(custom-set-variables
 ;; custom-set-variables 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.
 '(auto-compression-mode t nil (jka-compr))
 '(case-fold-search t)
 '(column-number-mode t)
 '(current-language-environment "Latin-1")
 '(default-input-method "latin-1-prefix")
 '(font-use-system-font t)
 '(global-font-lock-mode t nil (font-lock))
 '(send-mail-function 'mailclient-send-it)
 '(show-paren-mode t nil (paren))
 '(text-mode-hook
   '(turn-on-auto-fill
     (lambda nil
       (auto-fill-mode 1)
       (abbrev-mode 1))))
 '(warning-suppress-log-types '((comp)))
 '(warning-suppress-types '((comp))))


(defun linux-c-mode ()
  "C mode with adjusted defaults for use with the Linux kernel."
  (interactive)
  (c-mode)
  (c-set-style "K&R")
  (setq tab-width 8)
  (setq indent-tabs-mode t)
  (setq c-basic-offset 8))

(setq auto-mode-alist (cons '(".*\\.[ch]$" . linux-c-mode) auto-mode-alist))

(setq inhibit-startup-message t)
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
(add-hook 'message-mode-hook 'turn-on-flyspell)
(add-hook 'text-mode-hook 'turn-on-flyspell)
(add-hook 'c-mode-common-hook 'flyspell-prog-mode)
(add-hook 'tcl-mode-hook 'flyspell-prog-mode)
(defun turn-on-flyspell ()
  "Force flyspell-mode on using a positive arg.  For use in hooks."
  (interactive)
  (flyspell-mode 1))


;;Flyspell is compatible with TeX editing. That is, Flyspell tries, as much as 
possible, to avoid highlighting TeX command. In order to automate the starting 
of Flyspell when editing LaTeX source files, one may add the following 
expression in his .emacs file:

(add-hook 'LaTeX-mode-hook 'flyspell-mode)


;;Flyspell proposes corrections for miss-spelled words by the means of pop-up 
menus. Clicking Mouse-2 on a highlighted word will raise a menu that proposes 
corrections. Alternatively you will be able to store the word in the global 
dictionary, to add it to the current document dictionary or to ignore the 
miss-spelling for the current session.

;;Flyspell also proposes automatic corrections. With M-\t, Flyspell replaces 
current miss-spelled word with a possible correction. If several corrections 
are made possible, they are sorted and M-\t proposes a new correction each time 
hit. Corrections may be sorted by alphabetical ordering (the default) or by 
likeness to the current word ordering. To enable the likeness criteria, uses:

(setq flyspell-sort-corrections nil)


;;Flyspell considers that a word repeated twice is an error (for instance, the 
second word word is highlighted). This feature can be disable with:

(setq flyspell-doublon-as-error-flag nil)

;(add-to-list 'default-frame-alist '(font .  10x20 ))
;(set-face-attribute 'default t :font  10x20 )

(set-frame-font "10x20")

;; auto-complete taken from 
https://emacs.stackexchange.com/questions/5938/how-to-make-auto-complete-work-in-auctex-mode
(require 'package)
(package-initialize)
(ac-config-default)

;; Activate auto-complete for latex modes (AUCTeX or Emacs' builtin one).

;; https://raw.githubusercontent.com/vitoshka/ac-math/master/ac-math.el

(require 'unicode-math-input)

(require 'ac-math) ; This is not needed when you install from MELPA

(add-to-list 'ac-modes 'latex-mode)   ; make auto-complete aware of `latex-mode`

(defun ac-latex-mode-setup ()         ; add ac-sources to default ac-sources
  (setq ac-sources
     (append '(ac-source-math-unicode ac-source-math-latex 
ac-source-latex-commands)
         ac-sources)))

(setq ac-math-unicode-in-math-p t)

;; Activate autocomplete with ess from: 
https://stackoverflow.com/questions/16075012/emacs-ess-auto-complete

(setq ess-use-auto-complete t)

;; 
https://stackoverflow.com/questions/24106099/emacs-ess-indentation-and-auto-completion?rq=1

(define-key ess-mode-map [tab] 'ess-indent-or-complete)
(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 (:family "DejaVu Sans Mono" :foundry "PfEd" :slant normal 
:weight normal :height 162 :width normal)))))

;(add-to-list 'default-frame-alist '(font ."Terminus-20"))
;(set-face-attribute 'default t :font "Terminus-20")


;; 
http://blog.vivekhaldar.com/post/4809065853/dotemacs-extract-interactively-change-font-size
(defun my/zoom-in ()
  "Increase font size by 10 points"
  (interactive)
  (set-face-attribute 'default nil
                      :height
                      (+ (face-attribute 'default :height)
                         10)))

(defun my/zoom-out ()
  "Decrease font size by 10 points"
  (interactive)
  (set-face-attribute 'default nil
                      :height
                      (- (face-attribute 'default :height)

                         10)))


;; change font size, interactively
(global-set-key (kbd "C->") 'my/zoom-in)
(global-set-key (kbd "C-<") 'my/zoom-out)

(add-hook 'mail-mode-hook 'turn-on-auto-fill)
(defun my-mail-mode-hook ()
  (auto-fill-mode 1)
  (abbrev-mode 1)
  (local-set-key "\C-Xk" 'server-edit))
(add-hook 'mail-mode-hook 'my-mail-mode-hook)

  (add-to-list 'auto-mode-alist '(".*mutt.*" . message-mode))                   
                                                
  (setq mail-header-separator "")                                               
                                                
  (add-hook 'message-mode-hook
          'turn-on-auto-fill
          (function
           (lambda ()
             (progn
               (local-unset-key "\C-c\C-c")
               (define-key message-mode-map "\C-c\C-c" '(lambda ()
                                                          "save and exit 
quickly"
                                                          (interactive)
                                                          (save-buffer)
                                                          (server-edit)))))))


;; define a function that runs the given command line
(defun email-cleanup ()
   (call-process-shell-command "for f in /tmp/mutt-* ;do email-process $f 
;done"))

;; add the above function to the hook
(add-hook 'kill-emacs-hook #'email-cleanup)


;;https://endlessparentheses.com/ispell-and-abbrev-the-perfect-auto-correct.html
(define-key ctl-x-map "\C-i"
  #'endless/ispell-word-then-abbrev)

(defun endless/simple-get-word ()
  (car-safe (save-excursion (ispell-get-word nil))))

(defun endless/ispell-word-then-abbrev (p)
  "Call `ispell-word', then create an abbrev for it.
With prefix P, create local abbrev. Otherwise it will
be global.
If there's nothing wrong with the word at point, keep
looking for a typo until the beginning of buffer. You can
skip typos you don't want to fix with `SPC', and you can
abort completely with `C-g'."
  (interactive "P")
  (let (bef aft)
    (save-excursion
      (while (if (setq bef (endless/simple-get-word))
                 ;; Word was corrected or used quit.
                 (if (ispell-word nil 'quiet)
                     nil ; End the loop.
                   ;; Also end if we reach `bob'.
                   (not (bobp)))
               ;; If there's no word at point, keep looking
               ;; until `bob'.
               (not (bobp)))
        (backward-word)
        (backward-char))
      (setq aft (endless/simple-get-word)))
    (if (and aft bef (not (equal aft bef)))
        (let ((aft (downcase aft))
              (bef (downcase bef)))
          (define-abbrev
            (if p local-abbrev-table global-abbrev-table)
            bef aft)
          (message "\"%s\" now expands to \"%s\" %sally"
                   bef aft (if p "loc" "glob")))
      (user-error "No typo at or before point"))))

(setq save-abbrevs 'silently)
(setq-default abbrev-mode t)


;;https://bugzilla.redhat.com/show_bug.cgi?id=2109745#38



reply via email to

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