unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Bob Floyd" <bobfloyd@comcast.net>
To: "'Juri Linkov'" <juri@linkov.net>
Cc: 45617@debbugs.gnu.org
Subject: bug#45617: <query-replace> loses the edit region. Works in 23.3, broke in 26.3
Date: Sun, 24 Jan 2021 12:40:35 -0800	[thread overview]
Message-ID: <006101d6f291$2b537dc0$81fa7940$@net> (raw)
In-Reply-To: <87eeiba4jo.fsf@mail.linkov.net>

I'm embarrassed to include my .emacs file - it's an accumulation over time of a lot of stuff from unix and windows not cleaned up. Here it is: Maybe something in it causing the issue/ maybe not.

------------------------------------------------------------------------------------------------------------------------------

; To see ^M or write the file without ^M
; M-X set-variable<RET>
; inhibit-eol-conversion<RET>
; t<RET>

;(set-face-font default "Lucida Console")
;(set-default-font "Lucida Console")


;; 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)

(setenv "PATH" (concat "c:/cygwin/bin;" (getenv "PATH")))
(setq exec-path (cons "c:/cygwin/bin/" exec-path))
; Set emacs path in ".bashrc"
; emacs 22.3 & 23.1 complains
;(require 'cygwin-mount)
;(cygwin-mount-activate)

;;; Without this env var setting, Cygwin causes `ediff-buffers', at least,
;; to raise an error.
;;; Making this setting here might have no effect, as the env var is checked
;; only by the first Cygwin process
;;; invoked during your Windows session.  For best results, set this env
;; var globally, in Windows itself.
;;; An alternative might be to use `cygpath' to change from MS Windows file
;; names to POSIX.
;(setenv "CYGWIN" "nodosfilewarning")


; Replace DOS shell with Cygwin Bash Shell 
; see https://www.emacswiki.org/emacs/setup-cygwin.el

(add-hook 'comint-output-filter-functions
    'shell-strip-ctrl-m nil t)
(add-hook 'comint-output-filter-functions
    'comint-watch-for-password-prompt nil t)
;
(setq explicit-shell-file-name "bash")
(setq shell-file-name explicit-shell-file-name)
(setq explicit-bash-args       '("-i"))
;(setq explicit-bash-args       '("--login" "-i"))
;(setq explicit-shell-file-name "bash.exe")
;; For subprocesses invoked via the shell
;; (e.g., "shell -c command")
;(setq shell-file-name explicit-shell-file-name)



; Key Binding for Previous Commands 
; Some people like to use the up and down arrow keys to traverse through the previous commands. Here is the way to bind the keys. 

(add-hook 'shell-mode-hook 'n-shell-mode-hook)
(defun n-shell-mode-hook ()
  "12Jan2002 - bob, shell mode customizations."
  (local-set-key '[up] 'comint-previous-input)
  (local-set-key '[down] 'comint-next-input)
  (local-set-key '[(shift tab)] 'comint-next-matching-input-from-input)
;; suspend shell, not emacs
  (local-set-key "\C-z" 'self-insert-command )
)

; Gzip and Gunzip 
;When viewing files using the Emacs dired utility, press Z should compress or uncompress a file. Since Cygwin is equiped with the gzip utility, you should be able to get this function working on your Windows Gnu Emacs. The lisp statement you need in your .emacs file is 

(setq archive-zip-use-pkzip nil)


;
; make searches case sensitive
;
(setq         default-case-fold-search nil)
(setq-default case-fold-search nil)

;(setq auto-mode-list '("\\.d$" . c-mode))

; Enter c++ mode for .h files on windows - even though the file ends
; in .H emacs seems to think it's a little h and otherwise enters c mode
(setq auto-mode-alist (cons '("\\.h$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.HPP$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.D$" . c++-mode) auto-mode-alist))

; C customizing
; Note these constants enforce the location of {}'s and indentation.
;
; C-h i Indentation Functions
(require 'cc-mode)
(add-hook `c-mode-common-hook (lambda () (c-toggle-auto-state 1)))
;(add-hook `c-mode-common-hook (lambda () (c-toggle-hungry-state 1)))
; left '{' not indented
(c-set-offset 'substatement-open 0)
; c-lineup-multi-inher
(c-set-offset 'inher-cont 0)
; c-lineup-streamop
(c-set-offset 'stream-op 0)
; c-lineup-arglist
(c-set-offset 'arglist-cont-nonempty 0)
; c-lineup-arglist
;(c-set-offset 'arglist-intro 0)
;(c-set-offset 'arglist-close 0)
; c-lineup-math
(c-set-offset 'statement-cont 0)
; <RET> does auto indentation, like C-n
;(define-key c-mode-base-map "\C-m" 'c-context-line-break)
; syntax coloring
(global-font-lock-mode 1)

;(setq c-auto-newline t)
(setq c-tab-always-indent nil)
;(setq c-indent-level 4)
;(setq c-continued-statement-offset 4)
;(setq c-brace-offset -4)
;(setq c-brace-imaginary-offset 0)
;(setq c-argdecl-indent 2)
;(setq c-label-offset -4)
;(setq comment-multi-line t)
;(setq comment-start-skip "/\\*+[ \\n\\t]*")
;(setq comment-start "/*")
;(setq comment-end "*/")

; Matching '{' '}' , '<' '>', '[' ']' are hilighted
(show-paren-mode)


;
; compilation command
;
;(setq compile-command "make" )

;
; prevent deletion of auto saved files when the file is written
;
(setq delete-auto-save-files t)

;
; allow recursive use of minibuffers
;
(setq enable-recursive-minibuffers t)

;
; establish search paths to look for for programs
;
;(setq exec-path '("." "/usr/local/bin" "/usr/ucb" "/usr/bin" "/bin" "/mimi/devel/bin" "/mimi/emacs/etc"))

;
; establish the imagen printer as the one to default to
;
;(setq lpr-switches "-Pim")

;
; Regexp used by Newline command in shell mode to match subshell prompts.
;
;(setq shell-prompt-pattern "^.\.[0-9]*[0-9]>")

;
;  Let emacs know about my P and p macros
;
;(setq shell-pushd-regexp "pushd\\|p")
;(setq shell-popd-regexp "popd")
;

;
; Rebind ESC-r (move-to-window-line) to replace-string
;
(global-unset-key "\er")
(global-set-key "\er" 'replace-string)

; Get rid of the tool bar icons which take up screen space by toggleing
(tool-bar-mode -1)

; Choose visible flicker instead of auditable bell rings
;(setq visible-bell t)
; Or just silence the bell entirely
(set-message-beep 'silent)

; See http://www.emacswiki.org/emacs/PrintingPackage#toc5
; See printing.el
; Printer must be shared on CACHE
;(setq printer-name "//CACHE/HP Photosmart C7200 series")
;(setq printer-name "D:/Bob/PrintFile.ps") ; print postscript to a file
(require 'printing)		; load printing package
(setq pr-gv-command    "c:/Program Files/Ghostgum/gsview/gsview64.exe")
(setq pr-gs-command    "c:/Program Files/gs/gs8.64/bin/gswin32.exe")
(setq pr-print-using-ghostscript t) ; C7280 is not a postscript printer
(setq pr-faces-p t) ; print colors, fonts etc.
(pr-update-menus t)		; update now printer and utility menus


; Default scrolling of 5 lines at a time is too much. This sets it to 1 line
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
(setq mouse-wheel-progressive-speed nil)

;
; Bind 'goto-line'
;
(global-unset-key "\C-x\C-l")
(global-set-key "\C-x\C-l" 'goto-line)

(global-set-key [f2] 'grep)
(global-set-key [f3] 'tags-search)

;
; Bind 'query-replace-regexp'
;
(global-unset-key "\e$")
(global-set-key "\e$" 'query-replace-regexp)
(global-unset-key "\ee")
(global-set-key "\ee" 'replace-regexp)

;
; These re-maps are done to allow xon/xoff
;
;(global-unset-key "\C-s")
;(global-set-key "\es" 'isearch-forward)
;(global-unset-key "\C-q")
;(global-unset-key "\eq")
;(global-set-key "\eq" 'quoted-insert)

;(load-file "/usr/local/lib/emacs/19.19/lisp/hilit19.el")
; (cond (window-system
;        (setq hilit-mode-enable-list  '(not text-mode)
;	      hilit-auto-highlight-maxout 150000
;              hilit-background-mode   'light
;              hilit-inhibit-hooks     nil
;              hilit-inhibit-rebinding nil)
; 
;        (require 'hilit19)
;        ))


;(setq explicit-shell-file-name "C:/Program Files/Hamilton Shell/bin/csh.exe")

;(load-file "d:/src/cooksrc/database/emacs-setup.el")
;(global-set-key "\ep" 'cooksrc-file-preamble)


;
; Easy mark.
;
;(global-set-key   "\C- " 'set-mark-command)

;
; Easy way to clear screen and enter shell command
;
;(global-set-key   "\e\r" 'cr-top)

;
; cr-top and freeze screen
;
;(global-set-key   "\C-x\r" 'cr-top-freeze)

;(transient-mark-mode nil)
;(setq vc-make-backup-files 1)
;(setq vc-mistrust-permissions nil)

;
; Region hilite when mark is active
;
(transient-mark-mode t)

;(setq shell-file-name "c:/cygwin/bin/bash")
;(setq explicit-shell-file-name "c:/cygwin/bin/bash")
(shell)

;(eshell)
;(eshell-command-result "rm -f BROWSE; ebrowse *.h *.cpp *.xml")
;(shell-command "rm -f BROWSE; ebrowse smt2/maxflowsttest.cpp *.y *.l *.cpp *.xml")
;(rename-buffer "sh-cook")
;(shell-command "cd d:/bob")
;(shell)
;(rename-buffer "sh-endogLib")
;(shell-command "cd d:/endogLib; rm -f BROWSE; ebrowse */*.h")
;(shell-process-cd "d:/endogLib")
;(eshell)
;(rename-buffer "sh-endogLib")
;(make-frame-command)
;(find-file "BROWSE")
;(global-set-key   "\C-x4." 'ebrowse-tags-find-definition-other-window)
;(global-set-key   "\C-x."  'ebrowse-tags-find-definition)
;(global-set-key   "^[,"    'ebrowse-tags-loop-continue)


(put 'upcase-region 'disabled nil)

(put 'downcase-region 'disabled nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; gcc 4.3.4 does not understand greek variables, e.g. \alpha, coded in
; utf-8. Visual Studio 10 does.
;(prefer-coding-system 'utf-8)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; http://iris.math.aegean.gr/~atsol/emacs-unicode/
; This does not format tex - it only converts keyboard input sequences
; into special characters. 
; C-x RET C-\ TeX RET to enter TeX input method
; C-\ (toggle-input-method) toggles between latin and greek
; (describe-input-method) in TeX input method (mode line indicator:\)
; reveals the characters displayed and their LaTeX-like nmonic sequences.

;(load-file "C:/Program Files (x86)/Emacs-24.0.91/emacs-24.0.91/lisp/language/greek.el")
;(setq default-input-method "el_GR")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "auctex.el" nil t t)
;;   FIND THIS
;(load "preview-latex.el" nil t t)

; Refer to auctex.pdf Pp 54
;(setq TeX-auto-save nil)
; Refer to auctex.pdf Pp 55
;(setq TeX-parse-self t)
; Refer to auctex.pdf Pp 54
;(setq-default TeX-master "~/AUCTeXmaster")
(setq-default TeX-master t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




(setq TeX-electric-sub-and-superscript t)

(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.
 '(display-mm-dimensions-alist (quote (("" 384 . 240))))
 '(package-selected-packages (quote (auctex)))
 '(safe-local-variable-values
   (quote
    ((Base . 10)
     (Syntax . Common-Lisp)
     (Package . Maxima)))))
(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.
 )

;; recursive delete using "x" in Dired window without asking for each directory
(setq dired-recursive-deletes "t" )

;; Like C "{" matching for verilog


(eval-after-load 'verilog-mode 
  '(define-key verilog-mode-map (kbd "C-{") 'verilog-beg-of-defun))
(eval-after-load 'verilog-mode 
  '(define-key verilog-mode-map (kbd "C-}") 'verilog-end-of-defun))


(load-file "C:/Program Files/Emacs-26.3/share/emacs/site-lisp/web-mode.el")
;;(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))

(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; emacs 25 changes behavior. Here we restore it.
;; emacs 25 etags uses xref that no longer opens files so we need this
;; `https://stackoverflow.com/questions/7667888/how-to-find-the-files-in-tags-file-in-emacs`
(load-file "C:/Program Files/Emacs-26.3/share/emacs/site-lisp/tags-find-file.el")
(global-set-key (read-kbd-macro "C-,") 'tags-extra-find-file)

;; copying from windows clipboard
;; emacs 25 no longer yanks clipboard
;; `https://stackoverflow.com/questions/13036155/how-to-combine-emacs-primary-clipboard-copy-and-paste-behavior-on-ms-windows`
(setq select-active-regions nil)
(setq mouse-drag-copy-region t)
(global-set-key [mouse-2] 'mouse-yank-at-click)
;;;;;;;;;;;; IGNORE THIS STUFF ON WINDOWS ;;;;;;;;;;;;;;;;;;;;;;;
;; See NEWS.24 "Selection changes"
;; Above changes + these:
;(setq x-select-enable-primary t)
;(setq x-select-enable-clipboard nil)
;(global-set-key (kbd "<mouse-2>") 'clipboard-yank)
;;;;;;;;;;;; IGNORE THIS STUFF ON WINDOWS ;;;;;;;;;;;;;;;;;;;;;;;


; newline now does what C-j used to do and C-j does what newline did
(global-unset-key "\C-j")
(global-set-key "\C-j" 'newline)
(global-unset-key "\C-M")
(global-set-key "\C-M" 'electric-newline-and-maybe-indent)

(global-unset-key "\M-,")
(global-set-key "\M-," 'tags-loop-continue)

; Don't like shell opening in another buffer, in doing makes whatever was in
; it go away.
(push (cons "\\*shell\\*" display-buffer--same-window-action) display-buffer-alist)

(defun my-insert-file-name (filename &optional args)
    "Insert name of file FILENAME into buffer after point.
  
  Prefixed with \\[universal-argument], expand the file name to
  its fully canocalized path.  See `expand-file-name'.
  
  Prefixed with \\[negative-argument], use relative path to file
  name from current directory, `default-directory'.  See
  `file-relative-name'.
  
  The default with no prefix is to insert the file name exactly as
  it appears in the minibuffer prompt."
    ;; Based on insert-file in Emacs -- ashawley 20080926
    (interactive "*fInsert file name: \nP")
    (cond ((eq '- args)
           (insert (file-relative-name filename)))
          ((not (null args))
           (insert (expand-file-name filename)))
          (t
           (insert filename))))
  
  (global-set-key "\M-n" 'my-insert-file-name)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; https://stackoverflow.com/questions/13505113/how-to-open-the-native-cmd-exe-window-in-emacs

; M-x cmd opens a window running the windows developer cmd prompt in the
; directory of the emacs buffer.

(defun cmd () (interactive)
       (let ((proc (start-process "cmd" nil "cmd.exe" "/C" "start" "cmd.exe"
				  "/K" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\Common7\\Tools\\VsDevCmd.bat")))
	 (set-process-query-on-exit-flag proc nil))
       )

; M-x fiex opens the windows File Explorer in the directory of the emacs buffer.

(defun fiex () (interactive)
       (let ((proc (start-process "cmd" nil "cmd.exe" "/K" "explorer .")))
	 (set-process-query-on-exit-flag proc nil))
       )

;;

------------------------------------------------------------------------------------------------------------------------------

-----Original Message-----
From: Juri Linkov [mailto:juri@linkov.net] 
Sent: Saturday, January 23, 2021 10:31 AM
To: Bob Floyd
Cc: 'Eli Zaretskii'; 45617@debbugs.gnu.org
Subject: Re: bug#45617: <query-replace> loses the edit region. Works in 23.3, broke in 26.3

>>Do you mean that the region is deactivated after finishing query-replace?
>>That's how it's supposed to work.  Please always select entire region
>>before starting query-replace again.
>
> No, I always select the region, then begin <query-replace>.
>
> When I see the previous replacement in the command window:
>    Query replace in region (default _nmRoot ? _nmDolRoot):
> Instead of:
>    Query replace:
>
> Then I get the bad behavior.

Maybe you use own customization, not starting with 'emacs -Q'?
This might explain that after middle mouse click
your selection region changes to lines 1-4 and is never restored.
Because with 'emacs -Q' I see that the selection is deactivated
after middle mouse click, even when the previous replacement is:
Query replace in region (default _nmRoot ? _nmDolRoot):.






  reply	other threads:[~2021-01-24 20:40 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03  1:05 bug#45617: <query-replace> loses the edit region. Works in 23.3, broke in 26.3 Bob Floyd
2021-01-03 14:47 ` Eli Zaretskii
2021-01-03 19:18   ` Bob Floyd
2021-01-04 17:26     ` Eli Zaretskii
2021-01-04 17:37   ` Juri Linkov
2021-01-04 22:40     ` Bob Floyd
2021-01-05 18:27       ` Juri Linkov
2021-01-05 19:45         ` Bob Floyd
2021-01-06 17:44           ` Juri Linkov
2021-01-06 18:19             ` Eli Zaretskii
2021-01-06 22:10               ` Bob Floyd
2021-01-13 18:53                 ` Juri Linkov
2021-01-15  1:22                   ` Bob Floyd
2021-01-15  8:54                     ` Juri Linkov
2021-01-15 11:23                       ` Eli Zaretskii
2021-01-19 17:45                         ` Juri Linkov
2021-01-19 18:39                           ` Eli Zaretskii
2021-01-15 18:05                       ` Bob Floyd
2021-01-19 17:43                         ` Juri Linkov
2021-01-20 22:48                           ` Bob Floyd
2021-01-20 23:23                           ` Bob Floyd
2021-01-21 21:50                             ` Juri Linkov
2021-01-22 17:31                               ` Bob Floyd
2021-01-23 17:20                                 ` Juri Linkov
2021-01-23 18:03                                   ` Bob Floyd
2021-01-23 18:31                                     ` Juri Linkov
2021-01-24 20:40                                       ` Bob Floyd [this message]
2021-01-25 17:07                                         ` Juri Linkov
2021-01-25 18:13                                           ` Bob Floyd
2021-01-25 18:54                                             ` Juri Linkov
2021-01-25 19:34                                               ` Bob Floyd
2021-01-25 19:51                                                 ` Juri Linkov
2021-01-26  0:34                                                   ` Bob Floyd
2021-01-27  9:43                                                     ` Juri Linkov
2021-01-28 16:31                                                       ` Bob Floyd
2021-01-28 18:42                                                         ` Juri Linkov
2021-01-28 21:32                                                           ` Bob Floyd
2021-01-29  8:56                                                             ` Juri Linkov
2021-01-15 18:09                   ` Bob Floyd
2021-01-07 18:46               ` Juri Linkov
2021-01-07 19:36                 ` Eli Zaretskii

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='006101d6f291$2b537dc0$81fa7940$@net' \
    --to=bobfloyd@comcast.net \
    --cc=45617@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).