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

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

bug#21262: 25.0.50; Diff-mode gets confused about its narrowing if hunk


From: Charles A. Roelli
Subject: bug#21262: 25.0.50; Diff-mode gets confused about its narrowing if hunk source not found
Date: Mon, 21 Aug 2017 21:49:50 +0200

> From: Dima Kogan <dima@secretsauce.net>
> Date: Fri, 14 Aug 2015 22:12:09 -0700
> 
> Hi. This bug has been there since at least emacs23 it seems like. To
> reproduce:
> 
> 1. emacs -Q
> 
> 2. Open any patch file that has hunks from more than one file in it. For
> instance, the attached patch file works, but it really doesn't matter
> 
> 3. Narrow to just the second file's diffs. For instance: M-N M-N C-SPC
> C-> C-x n n SPC (last SPC to confirm the narrowing)
> 
> 4. Try to see the source of the hunk. Move the point to the guts of the
> hunk, and M-enter. Emacs asks for the directory where the sources live.
> In the process, it changes the narrowing to the wrong hunk. This is
> wrong. The narrowing shouldn't change.
> 
> 5. If we cancel with C-g, the wrong narrowing persists
> 
> 
> 
> diff --git a/src/charset.c b/src/charset.c
> index b19e344..eeebf17 100644
> --- a/src/charset.c
> +++ b/src/charset.c
> @@ -555,7 +555,7 @@ load_charset_map_from_vector (struct charset *charset, 
> Lisp_Object vec, int cont
>  
>    if (len % 2 == 1)
>      {
> -      add_to_log ("Failure in loading charset map: %V", vec, Qnil);
> +      add_to_log ("Failure in loading charset map: %V", vec);
>        return;
>      }
>  
> diff --git a/src/image.c b/src/image.c
> index 066db74..313419b 100644
> --- a/src/image.c
> +++ b/src/image.c
> @@ -629,16 +629,19 @@ valid_image_p (Lisp_Object object)
>  }
>  
>  
> -/* Log error message with format string FORMAT and argument ARG.
> +/* Log error message with format string FORMAT and trailing arguments.
>     Signaling an error, e.g. when an image cannot be loaded, is not a
>     good idea because this would interrupt redisplay, and the error
>     message display would lead to another redisplay.  This function
>     therefore simply displays a message.  */
>  
>  static void
> -image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2)
> +image_error (const char *format, ...)
>  {
> -  add_to_log (format, arg1, arg2);
> +  va_list ap;
> +  va_start (ap, format);
> +  vadd_to_log (format, ap);
> +  va_end (ap);
>  }
>  
>  

This still affects 26.0.50.

The attached change fixes it -- but I know nothing of diff-mode, so
better ideas are welcome.  Note that the buffer will be widened while
Emacs asks where to look for the sources, but it will return to the
original narrowing after the user has selected a file or hit C-g.

Attachment: 01-emacs-bug-21262-draft.patch
Description: Text Data


reply via email to

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