commit 124a3cb60b0b5e5f7802b494cafe2266e8cf5b2a (HEAD, refs/remotes/origin/master) Author: Michael Albinus Date: Tue Jul 27 09:28:28 2021 +0200 Final tweak for Tramp's yubikey detection * lisp/net/tramp.el (tramp-yubikey-regexp) (tramp-action-show-and-confirm-message): Expect also "\n". diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 5d7deada8b..2a664b6f79 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -700,7 +700,7 @@ The regexp should match at end of buffer." ;; Yubikey requires the user physically to touch the device with their ;; finger. We must tell it to the user. (defcustom tramp-yubikey-regexp - "^\r*Confirm user presence for key .*\r*" + "^\r*Confirm user presence for key .*[\r\n]*" "Regular expression matching yubikey confirmation message. The regexp should match at end of buffer." :version "28.1" @@ -4690,7 +4690,7 @@ Wait, until the connection buffer changes." (goto-char (point-min)) (tramp-check-for-regexp proc tramp-process-action-regexp) (tramp-message - vec 0 "%s" (replace-regexp-in-string "\r" "" (match-string 1))) + vec 0 "%s" (replace-regexp-in-string "[\r\n]" "" (match-string 1))) ;; Hide message. (narrow-to-region (point-max) (point-max)) ;; Wait for new output. commit d2d3fc39295953b4db5bdd7a21d513a87d3d00f0 Author: Alan Third Date: Sat Jul 24 16:08:09 2021 +0100 Convert fringe bitmaps to vectors on NS port Unfortunately *step doesn't support masks for bitmap images so changing the colors of fringe bitmaps is awkward. We can work around this by converting the bitmap into an NSBezierPath and drawing it in the required color. * src/nsterm.m (ns_define_fringe_bitmap): (ns_destroy_fringe_bitmap): New functions (ns_draw_fringe_bitmap): Display the NSBezierPath. * src/nsimage.m ([EmacsImage initFromXBM:width:height:fg:bg:reverseBytes:]): Remove variable that's there to allow us to easily modify the XBM colors. ([EmacsImage setXBMColor:]): Remove method. diff --git a/src/nsimage.m b/src/nsimage.m index 3668a7ab10..dd2bb3b0d7 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -377,51 +377,10 @@ - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h } } - xbm_fg = fg; [self addRepresentation: bmRep]; return self; } -/* Set color for a bitmap image. */ -- (instancetype)setXBMColor: (NSColor *)color -{ - NSSize s = [self size]; - unsigned char *planes[5]; - EmacsCGFloat r, g, b, a; - NSColor *rgbColor; - - if (bmRep == nil || color == nil) - return self; - - if ([color colorSpace] != [NSColorSpace genericRGBColorSpace]) - rgbColor = [color colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]]; - else - rgbColor = color; - - [rgbColor getRed: &r green: &g blue: &b alpha: &a]; - - [bmRep getBitmapDataPlanes: planes]; - - { - int i, len = s.width*s.height; - int rr = r * 0xff, gg = g * 0xff, bb = b * 0xff; - unsigned char fgr = (xbm_fg >> 16) & 0xff; - unsigned char fgg = (xbm_fg >> 8) & 0xff; - unsigned char fgb = xbm_fg & 0xff; - - for (i = 0; i < len; ++i) - if (planes[0][i] == fgr && planes[1][i] == fgg && planes[2][i] == fgb) - { - planes[0][i] = rr; - planes[1][i] = gg; - planes[2][i] = bb; - } - xbm_fg = ((rr << 16) & 0xff0000) + ((gg << 8) & 0xff00) + (bb & 0xff); - } - - return self; -} - - (instancetype)initForXPMWithDepth: (int)depth width: (int)width height: (int)height { diff --git a/src/nsterm.h b/src/nsterm.h index b29e76cc63..57c1e4cbae 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -647,7 +647,6 @@ typedef id instancetype; NSBitmapImageRep *bmRep; /* used for accessing pixel data */ unsigned char *pixmapData[5]; /* shortcut to access pixel data */ NSColor *stippleMask; - unsigned long xbm_fg; @public NSAffineTransform *transform; BOOL smoothing; @@ -657,7 +656,6 @@ typedef id instancetype; - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h fg: (unsigned long)fg bg: (unsigned long)bg reverseBytes: (BOOL)reverse; -- (instancetype)setXBMColor: (NSColor *)color; - (instancetype)initForXPMWithDepth: (int)depth width: (int)width height: (int)height; - (void)setPixmapData; - (unsigned long)getPixelAtX: (int)x Y: (int)y; diff --git a/src/nsterm.m b/src/nsterm.m index 9eff01c724..853c0fa2fa 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3067,6 +3067,39 @@ so some key presses (TAB) are swallowed by the system. */ ========================================================================== */ +static NSMutableDictionary *fringe_bmp; + +static void +ns_define_fringe_bitmap (int which, unsigned short *bits, int h, int w) +{ + NSBezierPath *p = [NSBezierPath bezierPath]; + + if (!fringe_bmp) + fringe_bmp = [[NSMutableDictionary alloc] initWithCapacity:25]; + + [p moveToPoint:NSMakePoint (0, 0)]; + + for (int y = 0 ; y < h ; y++) + for (int x = 0 ; x < w ; x++) + { + /* XBM rows are always round numbers of bytes, with any unused + bits ignored. */ + int byte = y * (w/8 + (w%8 ? 1 : 0)) + x/8; + bool bit = bits[byte] & (0x80 >> x%8); + if (bit) + [p appendBezierPathWithRect:NSMakeRect (x, y, 1, 1)]; + } + + [fringe_bmp setObject:p forKey:[NSNumber numberWithInt:which]]; +} + + +static void +ns_destroy_fringe_bitmap (int which) +{ + [fringe_bmp removeObjectForKey:[NSNumber numberWithInt:which]]; +} + extern int max_used_fringe_bitmap; static void @@ -3094,41 +3127,18 @@ so some key presses (TAB) are swallowed by the system. */ struct frame *f = XFRAME (WINDOW_FRAME (w)); struct face *face = p->face; - static EmacsImage **bimgs = NULL; - static int nBimgs = 0; NSRect clearRect = NSZeroRect; - NSRect imageRect = NSZeroRect; NSRect rowRect = ns_row_rect (w, row, ANY_AREA); NSTRACE_WHEN (NSTRACE_GROUP_FRINGE, "ns_draw_fringe_bitmap"); NSTRACE_MSG ("which:%d cursor:%d overlay:%d width:%d height:%d period:%d", p->which, p->cursor_p, p->overlay_p, p->wd, p->h, p->dh); - /* grow bimgs if needed */ - if (nBimgs < max_used_fringe_bitmap) - { - bimgs = xrealloc (bimgs, max_used_fringe_bitmap * sizeof *bimgs); - memset (bimgs + nBimgs, 0, - (max_used_fringe_bitmap - nBimgs) * sizeof *bimgs); - nBimgs = max_used_fringe_bitmap; - } - - /* Work out the rectangle we will composite into. */ - if (p->which) - imageRect = NSMakeRect (p->x, p->y, p->wd, p->h); + /* Work out the rectangle we will need to clear. */ + clearRect = NSMakeRect (p->x, p->y, p->wd, p->h); - /* Work out the rectangle we will need to clear. Because we're - compositing rather than blitting, we need to clear the area under - the image regardless of anything else. */ if (p->bx >= 0 && !p->overlay_p) - { - clearRect = NSMakeRect (p->bx, p->by, p->nx, p->ny); - clearRect = NSUnionRect (clearRect, imageRect); - } - else - { - clearRect = imageRect; - } + clearRect = NSUnionRect (clearRect, NSMakeRect (p->bx, p->by, p->nx, p->ny)); /* Handle partially visible rows. */ clearRect = NSIntersectionRect (clearRect, rowRect); @@ -3144,53 +3154,29 @@ so some key presses (TAB) are swallowed by the system. */ NSRectFill (clearRect); } - if (p->which) + NSBezierPath *bmp = [fringe_bmp objectForKey:[NSNumber numberWithInt:p->which]]; + if (bmp) { - EmacsImage *img = bimgs[p->which - 1]; - - if (!img) - { - // Note: For "periodic" images, allocate one EmacsImage for - // the base image, and use it for all dh:s. - unsigned short *bits = p->bits; - int full_height = p->h + p->dh; - int i; - unsigned char *cbits = xmalloc (full_height); - - for (i = 0; i < full_height; i++) - cbits[i] = bits[i]; - img = [[EmacsImage alloc] initFromXBM: cbits width: 8 - height: full_height - fg: 0 bg: 0 - reverseBytes: NO]; - bimgs[p->which - 1] = img; - xfree (cbits); - } + NSAffineTransform *transform = [NSAffineTransform transform]; + NSColor *bm_color; + /* Because the image is defined at (0, 0) we need to take a copy + and then transform that copy to the new origin. */ + bmp = [bmp copy]; + [transform translateXBy:p->x yBy:p->y - p->dh]; + [bmp transformUsingAffineTransform:transform]; - { - NSColor *bm_color; - if (!p->cursor_p) - bm_color = ns_lookup_indexed_color(face->foreground, f); - else if (p->overlay_p) - bm_color = ns_lookup_indexed_color(face->background, f); - else - bm_color = f->output_data.ns->cursor_color; - [img setXBMColor: bm_color]; - } - - // Note: For periodic images, the full image height is "h + hd". - // By using the height h, a suitable part of the image is used. - NSRect fromRect = NSMakeRect(0, 0, p->wd, p->h); + if (!p->cursor_p) + bm_color = ns_lookup_indexed_color(face->foreground, f); + else if (p->overlay_p) + bm_color = ns_lookup_indexed_color(face->background, f); + else + bm_color = f->output_data.ns->cursor_color; - NSTRACE_RECT ("fromRect", fromRect); + [bm_color set]; + [bmp fill]; - [img drawInRect: imageRect - fromRect: fromRect - operation: NSCompositingOperationSourceOver - fraction: 1.0 - respectFlipped: YES - hints: nil]; + [bmp release]; } ns_unfocus (f); } @@ -5162,8 +5148,8 @@ static Lisp_Object ns_string_to_lispmod (const char *s) gui_get_glyph_overhangs, gui_fix_overlapping_area, ns_draw_fringe_bitmap, - 0, /* define_fringe_bitmap */ /* FIXME: simplify ns_draw_fringe_bitmap */ - 0, /* destroy_fringe_bitmap */ + ns_define_fringe_bitmap, + ns_destroy_fringe_bitmap, ns_compute_glyph_string_overhangs, ns_draw_glyph_string, ns_define_frame_cursor, @@ -5349,6 +5335,8 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes. terminal->name = xlispstrdup (display_name); + gui_init_fringe (terminal->rif); + unblock_input (); if (!inhibit_x_resources) commit 9ce3fdc461c9ec799ccbdc9281e392b0b77efd2b Author: Alan Third Date: Sat Jul 17 13:04:58 2021 +0100 Fix NS inset rectangle corners * src/nsterm.m (ns_draw_relief): Use a path to draw the mitered corners instead of rectangles. diff --git a/src/nsterm.m b/src/nsterm.m index 98a0862aad..9eff01c724 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3665,7 +3665,7 @@ larger if there are taller display elements (e.g., characters static void -ns_draw_relief (NSRect r, int hthickness, int vthickness, char raised_p, +ns_draw_relief (NSRect outer, int hthickness, int vthickness, char raised_p, char top_p, char bottom_p, char left_p, char right_p, struct glyph_string *s) /* -------------------------------------------------------------------------- @@ -3676,7 +3676,7 @@ larger if there are taller display elements (e.g., characters { static NSColor *baseCol = nil, *lightCol = nil, *darkCol = nil; NSColor *newBaseCol = nil; - NSRect sr = r; + NSRect inner; NSTRACE ("ns_draw_relief"); @@ -3710,33 +3710,50 @@ larger if there are taller display elements (e.g., characters darkCol = [[baseCol shadowWithLevel: 0.3] retain]; } - [(raised_p ? lightCol : darkCol) set]; - - /* TODO: mitering. Using NSBezierPath doesn't work because of color switch. */ + /* Calculate the inner rectangle. */ + inner = NSInsetRect (outer, hthickness, vthickness); - /* top */ - sr.size.height = hthickness; - if (top_p) NSRectFill (sr); + [(raised_p ? lightCol : darkCol) set]; - /* left */ - sr.size.height = r.size.height; - sr.size.width = vthickness; - if (left_p) NSRectFill (sr); + if (top_p || left_p) + { + NSBezierPath *p = [NSBezierPath bezierPath]; + [p moveToPoint:NSMakePoint (NSMinX (outer), NSMinY (outer))]; + if (top_p) + { + [p lineToPoint:NSMakePoint (NSMaxX (outer), NSMinY (outer))]; + [p lineToPoint:NSMakePoint (NSMaxX (inner), NSMinY (inner))]; + } + [p lineToPoint:NSMakePoint (NSMinX (inner), NSMinY (inner))]; + if (left_p) + { + [p lineToPoint:NSMakePoint (NSMinX (inner), NSMaxY (inner))]; + [p lineToPoint:NSMakePoint (NSMinX (outer), NSMaxY (outer))]; + } + [p closePath]; + [p fill]; + } [(raised_p ? darkCol : lightCol) set]; - /* bottom */ - sr.size.width = r.size.width; - sr.size.height = hthickness; - sr.origin.y += r.size.height - hthickness; - if (bottom_p) NSRectFill (sr); - - /* right */ - sr.size.height = r.size.height; - sr.origin.y = r.origin.y; - sr.size.width = vthickness; - sr.origin.x += r.size.width - vthickness; - if (right_p) NSRectFill (sr); + if (bottom_p || right_p) + { + NSBezierPath *p = [NSBezierPath bezierPath]; + [p moveToPoint:NSMakePoint (NSMaxX (outer), NSMaxY (outer))]; + if (right_p) + { + [p lineToPoint:NSMakePoint (NSMaxX (outer), NSMinY (outer))]; + [p lineToPoint:NSMakePoint (NSMaxX (inner), NSMinY (inner))]; + } + [p lineToPoint:NSMakePoint (NSMaxX (inner), NSMaxY (inner))]; + if (bottom_p) + { + [p lineToPoint:NSMakePoint (NSMinX (inner), NSMaxY (inner))]; + [p lineToPoint:NSMakePoint (NSMinX (outer), NSMaxY (outer))]; + } + [p closePath]; + [p fill]; + } } commit 49bbed0dfdbf279d7b14240877e42e755041ffa4 Author: Alan Third Date: Sat Jul 17 11:23:42 2021 +0100 Simplify NS sizing and positioning code * src/nsterm.m (ns_set_offset): Unify the two branches into one, most of the code is the same. (ns_set_window_size): Use the provided tools to calculate the window size instead of doing it ourselves. diff --git a/src/nsterm.m b/src/nsterm.m index c3122291a9..98a0862aad 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1732,52 +1732,35 @@ Hide the window (X11 semantics) block_input (); - if (FRAME_PARENT_FRAME (f)) - { - /* Convert the parent frame's view rectangle into screen - coords. */ - EmacsView *parentView = FRAME_NS_VIEW (FRAME_PARENT_FRAME (f)); - NSRect parentRect = [parentView convertRect:[parentView frame] - toView:nil]; - parentRect = [[parentView window] convertRectToScreen:parentRect]; + /* If there is no parent frame then just convert to screen + coordinates, UNLESS we have negative values, in which case I + think it's best to position from the bottom and right of the + current screen rather than the main screen or whole display. */ - if (f->size_hint_flags & XNegative) - topLeft.x = NSMaxX (parentRect) - NSWidth (windowFrame) + xoff; - else - topLeft.x = NSMinX (parentRect) + xoff; + NSRect parentRect = ns_parent_window_rect (f); - if (f->size_hint_flags & YNegative) - topLeft.y = NSMinY (parentRect) + NSHeight (windowFrame) - yoff; - else - topLeft.y = NSMaxY (parentRect) - yoff; - } + if (f->size_hint_flags & XNegative) + topLeft.x = NSMaxX (parentRect) - NSWidth (windowFrame) + xoff; + else if (FRAME_PARENT_FRAME (f)) + topLeft.x = NSMinX (parentRect) + xoff; else - { - /* If there is no parent frame then just convert to screen - coordinates, UNLESS we have negative values, in which case I - think it's best to position from the bottom and right of the - current screen rather than the main screen or whole - display. */ - NSRect screenFrame = [[[view window] screen] frame]; - - if (f->size_hint_flags & XNegative) - topLeft.x = NSMaxX (screenFrame) - NSWidth (windowFrame) + xoff; - else - topLeft.x = xoff; + topLeft.x = xoff; - if (f->size_hint_flags & YNegative) - topLeft.y = NSMinY (screenFrame) + NSHeight (windowFrame) - yoff; - else - topLeft.y = NSMaxY ([[[NSScreen screens] objectAtIndex:0] frame]) - yoff; + if (f->size_hint_flags & YNegative) + topLeft.y = NSMinY (parentRect) + NSHeight (windowFrame) - yoff; + else if (FRAME_PARENT_FRAME (f)) + topLeft.y = NSMaxY (parentRect) - yoff; + else + topLeft.y = NSMaxY ([[[NSScreen screens] objectAtIndex:0] frame]) - yoff; #ifdef NS_IMPL_GNUSTEP - /* Don't overlap the menu. + /* Don't overlap the menu. - FIXME: Surely there's a better way than just hardcoding 100 - in here? */ - topLeft.x = 100; + FIXME: Surely there's a better way than just hardcoding 100 in + here? */ + if (topLeft.x < 100) + topLeft.x = 100; #endif - } NSTRACE_POINT ("setFrameTopLeftPoint", topLeft); [[view window] setFrameTopLeftPoint:topLeft]; @@ -1800,40 +1783,34 @@ Hide the window (X11 semantics) { EmacsView *view = FRAME_NS_VIEW (f); NSWindow *window = [view window]; - NSRect wr = [window frame]; - int orig_height = wr.size.height; + NSRect frameRect; NSTRACE ("ns_set_window_size"); if (view == nil) return; - NSTRACE_RECT ("current", wr); + NSTRACE_RECT ("current", [window frame]); NSTRACE_MSG ("Width:%d Height:%d", width, height); NSTRACE_MSG ("Font %d x %d", FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); block_input (); - wr.size.width = width + f->border_width; - wr.size.height = height; - if (! [view isFullscreen]) - wr.size.height += FRAME_NS_TITLEBAR_HEIGHT (f) - + FRAME_TOOLBAR_HEIGHT (f); - - /* Do not try to constrain to this screen. We may have multiple - screens, and want Emacs to span those. Constraining to screen - prevents that, and that is not nice to the user. */ - if (f->output_data.ns->zooming) - f->output_data.ns->zooming = 0; - else - wr.origin.y += orig_height - wr.size.height; - - /* Usually it seems safe to delay changing the frame size, but when a - series of actions are taken with no redisplay between them then we - can end up using old values so don't delay here. */ - change_frame_size (f, width, height, false, NO, false); - - [window setFrame:wr display:NO]; + frameRect = [window frameRectForContentRect:NSMakeRect (0, 0, width, height)]; + + /* Set the origin so the top left of the frame doesn't move. */ + frameRect.origin = [window frame].origin; + frameRect.origin.y += NSHeight ([view frame]) - height; + + if (f->output_data.ns->zooming) + f->output_data.ns->zooming = 0; + + /* Usually it seems safe to delay changing the frame size, but when a + series of actions are taken with no redisplay between them then we + can end up using old values so don't delay here. */ + change_frame_size (f, width, height, false, NO, false); + + [window setFrame:frameRect display:NO]; unblock_input (); } commit 0b54632013c07f89625c6abe2b26d787618025aa Author: Alan Third Date: Sat Jul 10 15:47:00 2021 +0100 * src/nsterm.m (ns_set_frame_alpha): Enable alpha on GNUstep. diff --git a/src/nsterm.m b/src/nsterm.m index b9e2c9b691..c3122291a9 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2433,12 +2433,10 @@ so some key presses (TAB) are swallowed by the system. */ else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0) alpha = alpha_min; -#ifdef NS_IMPL_COCOA { EmacsView *view = FRAME_NS_VIEW (f); - [[view window] setAlphaValue: alpha]; + [[view window] setAlphaValue: alpha]; } -#endif } commit 246803f26fdec5f425418210167da0f93d4b3401 Author: Alan Third Date: Sat Jul 24 12:44:19 2021 +0100 Fix image crash on macOS (bug#49688) * src/nsimage.m ([EmacsImage allocInitFromFile:]): Use isValid to check whether the image is valid instead of generating a tiff. diff --git a/src/nsimage.m b/src/nsimage.m index 3c16cd371e..3668a7ab10 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -265,16 +265,12 @@ + (instancetype)allocInitFromFile: (Lisp_Object)file image = [[EmacsImage alloc] initByReferencingFile:filename]; image->bmRep = nil; -#ifdef NS_IMPL_COCOA - imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; -#else - imgRep = [image bestRepresentationForDevice: nil]; -#endif - if (imgRep == nil) + if (![image isValid]) { [image release]; return nil; } + imgRep = [[image representations] firstObject]; [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; [image setName:filename]; commit 4f43058e9a69552e4bf600fd7a93bc1c459742ef Author: Mattias EngdegÄrd Date: Mon Jul 26 21:18:42 2021 +0200 Adjust grep-mode end-col function return value * lisp/progmodes/grep.el (grep-regexp-alist): Adjust the return value from the END-COL function by one since it is now (after fixing bug#49624) inclusive. Found by Juri Linkov. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 91c72a9429..8f0a5acf70 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -389,7 +389,7 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies (and mbeg (next-single-property-change mbeg 'font-lock-face nil end)))) (when mend - (- mend beg)))))) + (- mend beg 1)))))) nil nil (3 '(face nil display ":"))) ("^Binary file \\(.+\\) matches" 1 nil nil 0 1)) commit 67fe106d1007d3cef58aa789327ad66ed71e4902 Author: Michael Albinus Date: Mon Jul 26 20:51:57 2021 +0200 Some minor improvements for share handling in tramp-gvfs.el * lisp/net/tramp-gvfs.el (tramp-gvfs-connection-mounted-p): Set "share" connection property if the mount spec offers it. (tramp-gvfs-handle-get-remote-uid) (tramp-gvfs-handle-get-remote-gid): Use it. diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 579234f9f5..fcfad012ec 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -72,8 +72,8 @@ ;; process key retrieved by `tramp-get-process' (the main connection ;; process). Other processes could reuse these properties, avoiding ;; recomputation when a new asynchronous process is created by -;; `make-process'. Examples are "remote-path", -;; "unsafe-temporary-file" or "device" (tramp-adb.el). +;; `make-process'. Examples are "unsafe-temporary-file", +;; "remote-path", "device" (tramp-adb.el) or "share" (tramp-gvfs.el). ;;; Code: diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index db561b4fd0..eff14a2912 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1633,8 +1633,10 @@ If FILE-SYSTEM is non-nil, return file system attributes." ID-FORMAT valid values are `string' and `integer'." (if (equal id-format 'string) (tramp-file-name-user vec) - (when-let - ((localname (tramp-get-connection-property vec "default-location" nil))) + (when-let ((localname + (tramp-get-connection-property + (tramp-get-process vec) "share" + (tramp-get-connection-property vec "default-location" nil)))) (tramp-compat-file-attribute-user-id (file-attributes (tramp-make-tramp-file-name vec localname) id-format))))) @@ -1642,8 +1644,10 @@ ID-FORMAT valid values are `string' and `integer'." (defun tramp-gvfs-handle-get-remote-gid (vec id-format) "The gid of the remote connection VEC, in ID-FORMAT. ID-FORMAT valid values are `string' and `integer'." - (when-let - ((localname (tramp-get-connection-property vec "default-location" nil))) + (when-let ((localname + (tramp-get-connection-property + (tramp-get-process vec) "share" + (tramp-get-connection-property vec "default-location" nil)))) (tramp-compat-file-attribute-group-id (file-attributes (tramp-make-tramp-file-name vec localname) id-format)))) @@ -1997,6 +2001,9 @@ a downcased host name only." (tramp-set-file-property vec "/" "fuse-mountpoint" fuse-mountpoint) (tramp-set-connection-property vec "default-location" default-location) + (when share + (tramp-set-connection-property + (tramp-get-process vec) "share" (concat "/" share))) (throw 'mounted t))))))) (defun tramp-gvfs-unmount (vec) commit 1ff02c53b5f21dfcaff1794f3eb2f42fb6160dae Author: Michael Albinus Date: Mon Jul 26 15:44:32 2021 +0200 Adapt Tramp for yubikey * lisp/net/tramp.el (tramp-yubikey-regexp): Adapt value. (tramp-trace-functions): Adapt docstring. (tramp-process-action-regexp): New defvar. (tramp-action-password, tramp-process-one-action): Use it. (tramp-action-show-and-confirm-message): Rewrite. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 4db0b2e672..5d7deada8b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -586,8 +586,7 @@ Sometimes the prompt is reported to look like \"login as:\"." (defcustom tramp-shell-prompt-pattern ;; Allow a prompt to start right after a ^M since it indeed would be - ;; displayed at the beginning of the line (and Zsh uses it). This - ;; regexp works only for GNU Emacs. + ;; displayed at the beginning of the line (and Zsh uses it). ;; Allow also [] style prompts. They can appear only during ;; connection initialization; Tramp redefines the prompt afterwards. (concat "\\(?:^\\|\r\\)" @@ -701,7 +700,7 @@ The regexp should match at end of buffer." ;; Yubikey requires the user physically to touch the device with their ;; finger. We must tell it to the user. (defcustom tramp-yubikey-regexp - "Confirm user presence for key .*" + "^\r*Confirm user presence for key .*\r*" "Regular expression matching yubikey confirmation message. The regexp should match at end of buffer." :version "28.1" @@ -1914,7 +1913,7 @@ The outline level is equal to the verbosity of the Tramp message." (put #'tramp-trace-buffer-name 'tramp-suppress-trace t) (defvar tramp-trace-functions nil - "A list of non-Tramp functions to be trace with tramp-verbose > 10.") + "A list of non-Tramp functions to be traced with tramp-verbose > 10.") (defun tramp-debug-message (vec fmt-string &rest arguments) "Append message to debug buffer of VEC. @@ -4588,6 +4587,9 @@ of." ;; prompts from the remote host. See the variable ;; `tramp-actions-before-shell' for usage of these functions. +(defvar tramp-process-action-regexp nil + "The regexp used to invoke an action in `tramp-process-one-action'.") + (defun tramp-action-login (_proc vec) "Send the login name." (let ((user (or (tramp-file-name-user vec) @@ -4613,7 +4615,7 @@ of." (unless (tramp-get-connection-property vec "first-password-request" nil) (tramp-clear-passwd vec)) (goto-char (point-min)) - (tramp-check-for-regexp proc tramp-password-prompt-regexp) + (tramp-check-for-regexp proc tramp-process-action-regexp) (tramp-message vec 3 "Sending %s" (match-string 1)) ;; We don't call `tramp-send-string' in order to hide the ;; password from the debug buffer and the traces. @@ -4678,16 +4680,21 @@ The terminal type can be configured with `tramp-terminal-type'." (tramp-send-string vec tramp-local-end-of-line) t) -(defun tramp-action-show-and-confirm-message (_proc vec) +(defun tramp-action-show-and-confirm-message (proc vec) "Show the user a message for confirmation. -Wait, until the user has entered RET." - (save-window-excursion +Wait, until the connection buffer changes." + (with-current-buffer (process-buffer proc) (let ((enable-recursive-minibuffers t) (stimers (with-timeout-suspend))) - (with-current-buffer (tramp-get-connection-buffer vec) - (tramp-message vec 6 "\n%s" (buffer-string)) - (pop-to-buffer (current-buffer))) - (read-string "Press ENTER to continue") + (tramp-message vec 6 "\n%s" (buffer-string)) + (goto-char (point-min)) + (tramp-check-for-regexp proc tramp-process-action-regexp) + (tramp-message + vec 0 "%s" (replace-regexp-in-string "\r" "" (match-string 1))) + ;; Hide message. + (narrow-to-region (point-max) (point-max)) + ;; Wait for new output. + (tramp-wait-for-regexp proc 30 ".") ;; Reenable the timers. (with-timeout-unsuspend stimers))) t) @@ -4729,6 +4736,7 @@ Wait, until the user has entered RET." "Wait for output from the shell and perform one action. See `tramp-process-actions' for the format of ACTIONS." (let ((case-fold-search t) + tramp-process-action-regexp found todo item pattern action) (while (not found) ;; Reread output once all actions have been performed. @@ -4737,7 +4745,8 @@ See `tramp-process-actions' for the format of ACTIONS." (setq todo actions) (while todo (setq item (pop todo) - pattern (format "\\(%s\\)\\'" (symbol-value (nth 0 item))) + tramp-process-action-regexp (symbol-value (nth 0 item)) + pattern (format "\\(%s\\)\\'" tramp-process-action-regexp) action (nth 1 item)) (tramp-message vec 5 "Looking for regexp \"%s\" from remote shell" pattern)