From debbugs-submit-bounces@debbugs.gnu.org Tue May 26 10:01:26 2020 Received: (at submit) by debbugs.gnu.org; 26 May 2020 14:01:26 +0000 Received: from localhost ([127.0.0.1]:46022 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jda8z-0001FE-Kz for submit@debbugs.gnu.org; Tue, 26 May 2020 10:01:25 -0400 Received: from lists.gnu.org ([209.51.188.17]:36276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jda8y-0001F7-C7 for submit@debbugs.gnu.org; Tue, 26 May 2020 10:01:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jda8y-00087T-16 for bug-gnu-emacs@gnu.org; Tue, 26 May 2020 10:01:24 -0400 Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]:32897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jda8x-0004Lx-6k for bug-gnu-emacs@gnu.org; Tue, 26 May 2020 10:01:23 -0400 Received: by mail-qv1-xf30.google.com with SMTP id er16so9474168qvb.0 for ; Tue, 26 May 2020 07:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=user-agent:from:to:subject:message-id:date:mime-version; bh=9HTw4kLmOsxcvvt34AEPapIIBR/dJss3H9lyDPsWX9o=; b=As+7yMSq7mhjthf2OUKlo1eDNAzRAwyTaqB0lQ6/EjLfVzelsGgjexUfEJ9sZD53Yj ZTEcnYdJeo6Ubhxf/xIMuveBJg1L1lU6Bzz5w3LnvfATuuaQRg0Lap4rgaslEP7KZSws flziWoIBzl7JrBiKPys6E1wi/4kYeDrgzEkQSlGIEWa4zg/8gZCKJxyNMTuUGFUoDh3H 2fHiG8fc/RWo3NJf2QD4B/TzK4lvGOwqRiqH/6ibQBfamJDoWkMfjnHD7YGCFWXF3o1V FbigaVXpaU0FWQuADr8t4Ng7f07U5YBktZdtcZ7DwPCUeBx1z/rJSBy6lYjvQ1+U+9vS dL1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:message-id:date :mime-version; bh=9HTw4kLmOsxcvvt34AEPapIIBR/dJss3H9lyDPsWX9o=; b=Y3lDnpbjEDKDSuXk0wwIwXxbqCeoOfdwKAok9jZTnr8obxvF1S9v+LuGTlzCl6LOU1 DZ9zQ7IrX6xLf5f5rjuFMvLRTG9JPXBe4wwEzhtaTz8L7aKS4nTozutdwQyJZilDdQji xKTwTXuYTC9HhEele+rKUE5csbHDQVDLQGZqrGobhhqQlKXkrPcGhz/s8wacBLW8+KaV /hwF1k0BKZGQaKcDRTlSZV638v+jyOGPg58RfsU1QHiJDJGX8CDWaSyGWGQwH56NlKMG u0KNL9u9FVXneMVwwxg9opBbt7qanSJxIUVLA5qng/WRRu0tuxhJXx8tddLvSogCXVJR W34Q== X-Gm-Message-State: AOAM532L2zxhTqJSQDJNt709dR8xGTmg2KPGdmdXP9m3tRTRA0UPemGG gz7jfNA+DfcAGA2wNgC9VNj4Swim X-Google-Smtp-Source: ABdhPJx+ia4JORXAHjZml4akHonQh8HgtwOLNw1Qu0NvzQSYoPskf4mUmsCejgDrfsRhbMyEbtx/9Q== X-Received: by 2002:ad4:4145:: with SMTP id z5mr20131222qvp.29.1590501681350; Tue, 26 May 2020 07:01:21 -0700 (PDT) Received: from x250.gmail.com ([201.17.106.129]) by smtp.gmail.com with ESMTPSA id d207sm16226414qkc.49.2020.05.26.07.01.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 07:01:20 -0700 (PDT) User-agent: mu4e 1.4.7; emacs 26.3 From: Ellington Santos To: bug-gnu-emacs@gnu.org Subject: Implement %b status to battery-linux-sysfs in emacs 26.3 Message-ID: <87h7w24wy9.fsf@gmail.com> Date: Tue, 26 May 2020 11:01:18 -0300 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::f30; envelope-from=ellingtonsantos@gmail.com; helo=mail-qv1-xf30.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain; format=flowed This patch implements %b battery status to battery-linux-sysfs in emacs-26.3 battery.el --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=battery_sysfs_b_status.patch diff --git a/lisp/battery.el b/lisp/battery.el index e23dab4c91..1d5969762f 100644 --- a/lisp/battery.el +++ b/lisp/battery.el @@ -433,13 +433,15 @@ The following %-sequences are provided: %c Current capacity (mAh or mWh) %r Current rate %B Battery status (verbose) +%b Battery status, empty means high, `-' means low, + `!' means critical, and `+' means charging %d Temperature (in degrees Celsius) %p Battery load percentage %L AC line status (verbose) %m Remaining time (to charge or discharge) in minutes %h Remaining time (to charge or discharge) in hours %t Remaining time (to charge or discharge) in the form `h:min'" - (let (charging-state temperature hours + (let (charging-state temperature hours percentage-now ;; Some batteries report charges and current, other energy and power. ;; In order to reliably be able to combine those data, we convert them ;; all to energy/power (since we can't combine different charges if @@ -509,6 +511,8 @@ The following %-sequences are provided: energy-now (- energy-full energy-now)))) (setq hours (/ remaining power-now))))))) + (when (and (> energy-full 0) (> energy-now 0)) + (setq percentage-now (format "%.1f" (/ (* 100 energy-now) energy-full)))) (list (cons ?c (cond ((or (> energy-full 0) (> energy-now 0)) (number-to-string (/ energy-now voltage-now))) (t "N/A"))) @@ -522,10 +526,11 @@ The following %-sequences are provided: "N/A")) (cons ?d (or temperature "N/A")) (cons ?B (or charging-state "N/A")) - (cons ?p (cond ((and (> energy-full 0) (> energy-now 0)) - (format "%.1f" - (/ (* 100 energy-now) energy-full))) - (t "N/A"))) + (cons ?b (or (and (string= charging-state "Charging") "+") + (and percentage-now (< percentage-now battery-load-critical) "!") + (and percentage-now (< percentage-now battery-load-low) "-") + "")) + (cons ?p (or percentage-now "N/A")) (cons ?L (cond ((battery-search-for-one-match-in-files (list "/sys/class/power_supply/AC/online" --=-=-= Content-Type: text/plain; format=flowed -- Atenciosamente, Ellington Santos --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed May 27 17:29:01 2020 Received: (at 41540) by debbugs.gnu.org; 27 May 2020 21:29:01 +0000 Received: from localhost ([127.0.0.1]:50153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je3bh-0005vv-AU for submit@debbugs.gnu.org; Wed, 27 May 2020 17:29:01 -0400 Received: from mail-il1-f175.google.com ([209.85.166.175]:39954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je3bf-0005ve-F9; Wed, 27 May 2020 17:28:59 -0400 Received: by mail-il1-f175.google.com with SMTP id a18so8327331ilp.7; Wed, 27 May 2020 14:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=2x1Uk7kCOYw+EDfI8IXb6a8xpF3UAI/UkhFpkIq5MeQ=; b=Th3CsMNn0WeWoYa2zJRWB3hxRiHAHlyDARZNLLtzBqNwdx6BrTJxXcwojNtGv/Ualt hDDRLdia+9pYpttbB+k7wjO/mJDhdNsOfU3uEhmOQceSsVoOwFKk4X/92qfZJr6jToeI 8AfLwxFu+ML7J6ckz69fioOjBfFsT0fobrUZbr9YF4qPA2oJrZnHSNKza2+pEkf2tbxt DZfyflnQwIlZEIKQU+DqxwgKYvB3tIqPy3v5o0WyZ06LWwcl0D8HQ+fA+FE2m+DNqFUm 5uceBGT/QZ+WkTeNTywRBCAunEh6nmWOsxDO017cvhkkASinAzf14S3cknYGZSyF5hez Uxaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=2x1Uk7kCOYw+EDfI8IXb6a8xpF3UAI/UkhFpkIq5MeQ=; b=TWH0c/A1wiMF5PIAQdKeYJ4ZjTG4gSjMnTXt+tpoASmzKs8owl6+vJBLkJCvqyMGpA /8eDaV02exkL0pEb/Mda0+aPEFoj4gRAQ3IVmexQCo812Rg/sU92BtkulvkGal+63pe1 pbtFkcTnl4VWlswnrki9U0+9UrTn0Ce/sgwmRzFL63WCjoaPduf/Iy+g6iPTU9x29z66 SooSW/jALtcFrTd0km1Zn1CpGPiL7qmomIRZT98AGkL8nrFzyZEucM83LMQWleoTXg5Z ZkSWU+3RmX8ymDmY9yqoJyJVc+YI/RQhVC/SjoQRg/yNcvImuJZ/Y05whKBNnaxmGh5S tR0Q== X-Gm-Message-State: AOAM532e5SIDv4nT1HExgolDaZ/yyGCZTkTLK2JJXL4hXyvzpjxH6TkH X6JugjgJ+4beMekUzKxNlGqmWRB4 X-Google-Smtp-Source: ABdhPJzGnVQQq1opn0l5yzhdilBtXwS4ErtzBq3QIcLFGj1bfXEDxxKODdp/+nDHfeQaIEQK9oLkVg== X-Received: by 2002:a05:6e02:46:: with SMTP id i6mr254295ilr.298.1590614933812; Wed, 27 May 2020 14:28:53 -0700 (PDT) Received: from vhost2 (CPE001143542e1f-CMf81d0f809fa0.cpe.net.cable.rogers.com. [99.230.38.42]) by smtp.gmail.com with ESMTPSA id m12sm397188ili.41.2020.05.27.14.28.53 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 May 2020 14:28:53 -0700 (PDT) From: Noam Postavsky To: Ellington Santos Subject: Re: bug#41540: Implement %b status to battery-linux-sysfs in emacs 26.3 References: <87h7w24wy9.fsf@gmail.com> Date: Wed, 27 May 2020 17:28:52 -0400 In-Reply-To: <87h7w24wy9.fsf@gmail.com> (Ellington Santos's message of "Tue, 26 May 2020 11:01:18 -0300") Message-ID: <85a71tt6cr.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41540 Cc: 41540@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) forwarded 41540 https://debbugs.gnu.org/41542 close 41540 severity 41542 wishlist tags 41542 + patch quit This bug seems to have been accidentally duped. Closing in favour of the newer thread. From unknown Tue Jun 17 01:44:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 25 Jun 2020 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator