From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Tadeus Prastowo Newsgroups: gmane.emacs.devel Subject: [pcomplete.el (pcomplete-completions-at-point)] Why max? Date: Sat, 16 Mar 2019 23:29:38 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="131197"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: John Wiegley Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 16 23:39:20 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5HxX-000Y4Q-RW for ged-emacs-devel@m.gmane.org; Sat, 16 Mar 2019 23:39:20 +0100 Original-Received: from localhost ([127.0.0.1]:47311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5HxW-0003dm-OI for ged-emacs-devel@m.gmane.org; Sat, 16 Mar 2019 18:39:18 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h5Hwt-0003aK-0E for emacs-devel@gnu.org; Sat, 16 Mar 2019 18:38:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h5HoO-00076N-Pq for emacs-devel@gnu.org; Sat, 16 Mar 2019 18:29:53 -0400 Original-Received: from mail-it1-x130.google.com ([2607:f8b0:4864:20::130]:37812) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h5HoO-00071T-9b for emacs-devel@gnu.org; Sat, 16 Mar 2019 18:29:52 -0400 Original-Received: by mail-it1-x130.google.com with SMTP id z124so16245816itc.2 for ; Sat, 16 Mar 2019 15:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unitn.it; s=google; h=mime-version:from:date:message-id:subject:to:cc; bh=fZ0/cXpzAYXV601Z0dmVPSzROZXHhXQCknhd/cxY1vk=; b=j8j9+Pb5Yf62ij6qxYFzMLQrikQG3+u0jueMaR9zrr4c1tzvdYIOgMXAUfsySf9vfP 0mM2oB8rzdjY8Ghk0Tsyb4KCeQGgQoKwkN+0PE5ko+XU31y70P1QkA1+cCUY6BBf0Trr MkD+l4JHYZTe/Shk8ilwmstuZX8syzYVcmIdw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=fZ0/cXpzAYXV601Z0dmVPSzROZXHhXQCknhd/cxY1vk=; b=X+A7WWKIcJDD9l/cXU43d7wMhGXuu9TpE/1rHKqX27M3Xur85wyjlSIoOmKSaLaEAc M301mVBaNnYdgxzXnPo/8CNb73hqWNnYh0gXhchF3nTW/Bk/K7DoWs5rdTcT25oe2pLa t0qYOYiUjAoZMkLEkTKn57WQZQ0pBuJYpyXpIHAdZ7g0iCYKAyKvcxWk5w4/M+krVswS m5t6WzSqPWVKYrLKl2rPV+4qdDXBTYiNTnicRjTlizfuSH6uvMsRQx9pZd5M/JfUK/rb oCVSHhDP/KlIR4F0sIp7B6mn8v7y/iR3YtVmPZ1WW5aPajEUQgSRJ7FmfoPmclaMYYGJ fFbQ== X-Gm-Message-State: APjAAAUM/HLHpxT+dHvZ9on5STErzLuzVap16/Owfry5wj0MNd+ReB52 T8ugZi/z5T/J3GQsuECTkr618Gpbi4VkI7fkAZPJOS8FKA== X-Google-Smtp-Source: APXvYqyldPRKU+N3b8oR1OyEpU+ITxxsoZL6AR794LXHrIcY/bBNOhYUWX+pwMSN0xnD0+TLeEw4ijc9KG3mxuiSBz4= X-Received: by 2002:a05:660c:6c5:: with SMTP id z5mr289387itk.160.1552775390211; Sat, 16 Mar 2019 15:29:50 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::130 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234247 Archived-At: Hi John, I am using Emacs at commit 4633b0e and see a problem that can be solved ad-hoc by using `min' instead of `max' in the following code within function `pcomplete-completions-at-point' in file `lisp/pcomplete.el': (beg (max (- (point) (length pcomplete-stub)) (pcomplete-begin))) What do you think will break if `min' is used instead of `max' to repair the following problem seen using `emacs -Q' at the said commit? M-x shell cd /tmp mkdir AAAA\ BB\ CCCC cd AAAA\ BB Autocomplete fails because (pcomplete-begin) returns the position of the first letter A but (length pcomplete-stub) is the length of "AAAA BB", which gives the position of the second letter A. The function `max', therefore, sets `beg' to the start of the second letter A. Consequently, file-name-completion will be asked to complete "AAA BB" instead of the correct one "AAAA BB". Thank you. -- Best regards, Tadeus