aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2020-01-08 09:09:47 -0800
committerGlenn Morris2020-01-08 09:09:47 -0800
commitb968b733a2a0450eb7312a5e72c059ec3c59ddd9 (patch)
treeda0790ada823a4d7dee009e9df63b3b24d0d539b /lisp
parentf8a0b02949342b887822e7756fd36f06536c9c01 (diff)
parent6cd9ccb0a28ec03ffe180b7429e0378511b7d459 (diff)
downloademacs-b968b733a2a0450eb7312a5e72c059ec3c59ddd9.tar.gz
emacs-b968b733a2a0450eb7312a5e72c059ec3c59ddd9.zip
Merge from origin/emacs-27
6cd9ccb0a2 (origin/emacs-27) Fix compression of directories in Dired 42329e6d3b ; * etc/NEWS: Review of the whole text. af5709f16b Further enhancement on `tramp-file-local-name' fb432446f5 Objective C Mode imenu: cease recognizing "functions" with... a18373a999 ; * etc/NEWS: Update the text about the XDG_CONFIG_HOME/em... 73fd8a4b53 Fix BSD and macOS builds w.r.t. pthread_setname_np (bug#38... f54b24304d Scale top-left coordinates in display-monitor-attributes-list b46c75b16c xref-matches-in-files: Big Tramp speed-up 883b3490d8 * lisp/net/tramp.el (tramp-file-local-name): Remove `save-... c01f55f126 Fix rendering bug due to unsynchronized cairo surface size... 075f21c0e3 Avoid crash by access to cleared img->pixmap->data/img->ma... 16c6dfb4f1 Avoid assertion violations in very small-height windows 9063124b91 Use pthread_setname_np to set thread name # Conflicts: # etc/NEWS # lisp/net/tramp.el
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired-aux.el16
-rw-r--r--lisp/net/tramp.el21
-rw-r--r--lisp/progmodes/cc-menus.el98
-rw-r--r--lisp/progmodes/xref.el10
4 files changed, 80 insertions, 65 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 59d389dc630..0069c1744dc 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -992,7 +992,14 @@ command with a prefix argument (the value does not matter)."
992 (ignore-errors (dired-remove-entry new-file)) 992 (ignore-errors (dired-remove-entry new-file))
993 (goto-char start) 993 (goto-char start)
994 ;; Now replace the current line with an entry for NEW-FILE. 994 ;; Now replace the current line with an entry for NEW-FILE.
995 (dired-update-file-line new-file) nil) 995 ;; But don't remove the current line if either FROM-FILE or
996 ;; NEW-FILE is a directory, because compressing/uncompressing
997 ;; directories doesn't remove the original.
998 (if (or (file-directory-p from-file)
999 (file-directory-p new-file))
1000 (dired-add-entry new-file nil t)
1001 (dired-update-file-line new-file))
1002 nil)
996 (dired-log (concat "Failed to (un)compress " from-file)) 1003 (dired-log (concat "Failed to (un)compress " from-file))
997 from-file))) 1004 from-file)))
998 1005
@@ -1020,8 +1027,9 @@ command with a prefix argument (the value does not matter)."
1020 ("\\.7z\\'" "" "7z x -aoa -o%o %i") 1027 ("\\.7z\\'" "" "7z x -aoa -o%o %i")
1021 ;; This item controls naming for compression. 1028 ;; This item controls naming for compression.
1022 ("\\.tar\\'" ".tgz" nil) 1029 ("\\.tar\\'" ".tgz" nil)
1023 ;; This item controls the compression of directories 1030 ;; This item controls the compression of directories. Its REGEXP
1024 (":" ".tar.gz" "tar -cf - %i | gzip -c9 > %o")) 1031 ;; element should never match any valid file name.
1032 ("\000" ".tar.gz" "tar -cf - %i | gzip -c9 > %o"))
1025 "Control changes in file name suffixes for compression and uncompression. 1033 "Control changes in file name suffixes for compression and uncompression.
1026Each element specifies one transformation rule, and has the form: 1034Each element specifies one transformation rule, and has the form:
1027 (REGEXP NEW-SUFFIX PROGRAM) 1035 (REGEXP NEW-SUFFIX PROGRAM)
@@ -1145,7 +1153,7 @@ Return nil if no change in files."
1145 (condition-case nil 1153 (condition-case nil
1146 (if (file-directory-p file) 1154 (if (file-directory-p file)
1147 (progn 1155 (progn
1148 (setq suffix (cdr (assoc ":" dired-compress-file-suffixes))) 1156 (setq suffix (cdr (assoc "\000" dired-compress-file-suffixes)))
1149 (when suffix 1157 (when suffix
1150 (let ((out-name (concat file (car suffix))) 1158 (let ((out-name (concat file (car suffix)))
1151 (default-directory (file-name-directory file))) 1159 (default-directory (file-name-directory file)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 22bac9ce459..a7c9b34d29d 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1330,8 +1330,7 @@ entry does not exist, return nil."
1330 t)) 1330 t))
1331 1331
1332;; This function bypasses the file name handler approach. It is NOT 1332;; This function bypasses the file name handler approach. It is NOT
1333;; recommended to use it in any package if not absolutely necessary, 1333;; recommended to use it in any package if not absolutely necessary.
1334;; because it won't work for remote file names not supported by Tramp.
1335;; However, it is more performant than `file-local-name', and might be 1334;; However, it is more performant than `file-local-name', and might be
1336;; useful where performance matters, like in operations over a bulk 1335;; useful where performance matters, like in operations over a bulk
1337;; list of file names. 1336;; list of file names.
@@ -1339,16 +1338,14 @@ entry does not exist, return nil."
1339 "Return the local name component of NAME. 1338 "Return the local name component of NAME.
1340This function removes from NAME the specification of the remote 1339This function removes from NAME the specification of the remote
1341host and the method of accessing the host, leaving only the part 1340host and the method of accessing the host, leaving only the part
1342that identifies NAME locally on the remote system. NAME must be 1341that identifies NAME locally on the remote system. If NAME does
1343a string that matches `tramp-file-name-regexp'. If NAME does not 1342not match `tramp-file-name-regexp', just `file-local-name' is
1344match `tramp-file-name-regexp', just NAME is returned. The 1343called. The returned file name can be used directly as argument
1345returned file name can be used directly as argument of 1344of `process-file', `start-file-process', or `shell-command'."
1346`process-file', `start-file-process', or `shell-command'." 1345 (or (and (tramp-tramp-file-p name)
1347 (save-match-data 1346 (string-match (nth 0 tramp-file-name-structure) name)
1348 (or (and (tramp-tramp-file-p name) 1347 (match-string (nth 4 tramp-file-name-structure) name))
1349 (string-match (nth 0 tramp-file-name-structure) name) 1348 (tramp-compat-file-local-name name)))
1350 (match-string (nth 4 tramp-file-name-structure) name))
1351 name)))
1352 1349
1353;; The localname can be quoted with "/:". Extract this. 1350;; The localname can be quoted with "/:". Extract this.
1354(defun tramp-unquote-file-local-name (name) 1351(defun tramp-unquote-file-local-name (name)
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el
index 9c8c7ab56f5..97037dea6e8 100644
--- a/lisp/progmodes/cc-menus.el
+++ b/lisp/progmodes/cc-menus.el
@@ -45,6 +45,7 @@
45(cc-bytecomp-defvar imenu-case-fold-search) 45(cc-bytecomp-defvar imenu-case-fold-search)
46(cc-bytecomp-defvar imenu-generic-expression) 46(cc-bytecomp-defvar imenu-generic-expression)
47(cc-bytecomp-defvar imenu-create-index-function) 47(cc-bytecomp-defvar imenu-create-index-function)
48(cc-bytecomp-defun c-literal-limits)
48 49
49 50
50;; imenu integration 51;; imenu integration
@@ -437,55 +438,56 @@ Example:
437 (goto-char (point-max)) 438 (goto-char (point-max))
438 ;; 439 ;;
439 (while (re-search-backward cc-imenu-objc-generic-expression nil t) 440 (while (re-search-backward cc-imenu-objc-generic-expression nil t)
440 (setq langnum (if (match-beginning OBJC) 441 (when (not (c-literal-limits))
441 OBJC 442 (setq langnum (if (match-beginning OBJC)
442 (cond 443 OBJC
443 ((match-beginning Cproto) Cproto) 444 (cond
444 ((match-beginning Cgeneralfunc) Cgeneralfunc) 445 ((match-beginning Cproto) Cproto)
445 ((match-beginning Cnoreturn) Cnoreturn)))) 446 ((match-beginning Cgeneralfunc) Cgeneralfunc)
446 (setq str (funcall func (match-beginning langnum) (match-end langnum))) 447 ((match-beginning Cnoreturn) Cnoreturn))))
447 ;; 448 (setq str (funcall func (match-beginning langnum) (match-end langnum)))
448 (cond 449 ;;
449 ;;
450 ;; C
451 ;;
452 ((not (eq langnum OBJC))
453 (setq clist (cons (cons str (match-beginning langnum)) clist)))
454 ;;
455 ;; ObjC
456 ;;
457 ;; An instance Method
458 ((eq (aref str 0) ?-)
459 (setq str (concat "-" (cc-imenu-objc-method-to-selector str)))
460 (setq methodlist (cons (cons str
461 (match-beginning langnum))
462 methodlist)))
463 ;; A factory Method
464 ((eq (aref str 0) ?+)
465 (setq str (concat "+" (cc-imenu-objc-method-to-selector str)))
466 (setq methodlist (cons (cons str
467 (match-beginning langnum))
468 methodlist)))
469 ;; Interface or implementation or protocol
470 ((eq (aref str 0) ?@)
471 (setq classcount (1+ classcount))
472 (cond 450 (cond
473 ((and (> (length str) implen) 451 ;;
474 (string= (substring str 0 implen) "@implementation")) 452 ;; C
475 (setq str (substring str implen) 453 ;;
476 str2 "@implementation")) 454 ((not (eq langnum OBJC))
477 ((string= (substring str 0 intflen) "@interface") 455 (setq clist (cons (cons str (match-beginning langnum)) clist)))
478 (setq str (substring str intflen) 456 ;;
479 str2 "@interface")) 457 ;; ObjC
480 ((string= (substring str 0 prtlen) "@protocol") 458 ;;
481 (setq str (substring str prtlen) 459 ;; An instance Method
482 str2 "@protocol"))) 460 ((eq (aref str 0) ?-)
483 (setq str (cc-imenu-objc-remove-white-space str)) 461 (setq str (concat "-" (cc-imenu-objc-method-to-selector str)))
484 (setq methodlist (cons (cons str2 462 (setq methodlist (cons (cons str
485 (match-beginning langnum)) 463 (match-beginning langnum))
486 methodlist)) 464 methodlist)))
487 (setq toplist (cons (cons str methodlist) toplist) 465 ;; A factory Method
488 methodlist nil)))) 466 ((eq (aref str 0) ?+)
467 (setq str (concat "+" (cc-imenu-objc-method-to-selector str)))
468 (setq methodlist (cons (cons str
469 (match-beginning langnum))
470 methodlist)))
471 ;; Interface or implementation or protocol
472 ((eq (aref str 0) ?@)
473 (setq classcount (1+ classcount))
474 (cond
475 ((and (> (length str) implen)
476 (string= (substring str 0 implen) "@implementation"))
477 (setq str (substring str implen)
478 str2 "@implementation"))
479 ((string= (substring str 0 intflen) "@interface")
480 (setq str (substring str intflen)
481 str2 "@interface"))
482 ((string= (substring str 0 prtlen) "@protocol")
483 (setq str (substring str prtlen)
484 str2 "@protocol")))
485 (setq str (cc-imenu-objc-remove-white-space str))
486 (setq methodlist (cons (cons str2
487 (match-beginning langnum))
488 methodlist))
489 (setq toplist (cons (cons str methodlist) toplist)
490 methodlist nil)))))
489 491
490 ;; In this buffer, there is only one or zero @{interface|implementation|protocol}. 492 ;; In this buffer, there is only one or zero @{interface|implementation|protocol}.
491 (if (< classcount 2) 493 (if (< classcount 2)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index a8ca6f8fbec..4fbcd08506b 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1218,6 +1218,9 @@ IGNORES is a list of glob patterns for files to ignore."
1218 #'xref-matches-in-directory 1218 #'xref-matches-in-directory
1219 "27.1") 1219 "27.1")
1220 1220
1221(declare-function tramp-tramp-file-p "tramp")
1222(declare-function tramp-file-local-name "tramp")
1223
1221;;;###autoload 1224;;;###autoload
1222(defun xref-matches-in-files (regexp files) 1225(defun xref-matches-in-files (regexp files)
1223 "Find all matches for REGEXP in FILES. 1226 "Find all matches for REGEXP in FILES.
@@ -1240,7 +1243,12 @@ FILES must be a list of absolute file names."
1240 "") 1243 "")
1241 (shell-quote-argument (xref--regexp-to-extended regexp))))) 1244 (shell-quote-argument (xref--regexp-to-extended regexp)))))
1242 (when remote-id 1245 (when remote-id
1243 (setq files (mapcar #'file-local-name files))) 1246 (require 'tramp)
1247 (setq files (mapcar
1248 (if (tramp-tramp-file-p dir)
1249 #'tramp-file-local-name
1250 #'file-local-name)
1251 files)))
1244 (with-current-buffer output 1252 (with-current-buffer output
1245 (erase-buffer) 1253 (erase-buffer)
1246 (with-temp-buffer 1254 (with-temp-buffer