[elpa] externals/counsel ccb2ff6 3/3: Delete file not needed in elpa.git

2021-08-02 Thread Basil L. Contovounesios
branch: externals/counsel
commit ccb2ff6fa74880454eb8a0c7398231b58fc00f16
Author: Basil L. Contovounesios 
Commit: Basil L. Contovounesios 

Delete file not needed in elpa.git

* .github/workflows/test.yml: Delete file used by GitHub CI.
---
 .github/workflows/test.yml | 52 --
 1 file changed, 52 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
deleted file mode 100644
index 11e6514..000
--- a/.github/workflows/test.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-name: CI
-on:
-  pull_request:
-paths-ignore:
-- '**.md'
-- '**.org'
-- '.dir-locals.el'
-- '.elpaignore'
-- '.gitignore'
-- 'doc/**'
-branches:
-  - master
-  push:
-paths-ignore:
-- '**.md'
-- '**.org'
-- '.dir-locals.el'
-- '.elpaignore'
-- '.gitignore'
-- 'doc/**'
-
-jobs:
-  build:
-runs-on: ubuntu-latest
-strategy:
-  fail-fast: false
-  matrix:
-emacs_version:
-  - 24.5
-  - 25.1
-  - 25.2
-  - 25.3
-  - 26.1
-  - 26.2
-  - 26.3
-  - 27.1
-  - snapshot
-
-steps:
-- uses: purcell/setup-emacs@master
-  with:
-version: ${{ matrix.emacs_version }}
-
-- uses: actions/checkout@v2
-
-- name: Check Emacs version
-  run: emacs --version
-
-- name: Test
-  run: |
-make deps
-make test



[elpa] externals/counsel updated (ba18ac9 -> ccb2ff6)

2021-08-02 Thread Basil L. Contovounesios
blc pushed a change to branch externals/counsel.

  from  ba18ac9   Merge branch 'master' into externals/counsel
  adds  11444e8   Fix pathological swiper-isearch-backward
  adds  e8ac2e2   Consider character widths when inserting prompt
  adds  7c5d49f   Improve manual line wrapping in long prompts
  adds  f6b46bc   Fix swiper-avy error with swiper-isearch (#2873)
  adds  a5eade0   Fix swiper-avy indexing in swiper-isearch (#2873)
  adds  487e97a   Use new GNU ELPA badges
  adds  4dd6acf   Make sure completion-metadata is fetched when formatting 
candidates
  adds  040d458   Prevent overriding completions annotations faces
  adds  a3c30e9   CI: Add GitHub actions test to replace Travis
  adds  56139df   Reinstate README CI badge
  adds  1642e20   Fix ivy-restrict-to-matches for dynamic colls
  adds  031d4d0   Preserve idx text property in marked candidates
  adds  20d78ae   Fix byte-compilation warning on Emacs --without-x
   new  bde2176   Add "other window" action for counsel-bookmark
   new  d2f290a   Merge branch 'master' into externals/counsel
   new  ccb2ff6   Delete file not needed in elpa.git


Summary of changes:
 counsel.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



[elpa] externals/counsel bde2176 1/3: Add "other window" action for counsel-bookmark

2021-08-02 Thread Basil L. Contovounesios
branch: externals/counsel
commit bde2176e89aa38344f700e9e7f9fc5c7b4fc471f
Author: Hugo Heagren 
Commit: Basil L. Contovounesios 

Add "other window" action for counsel-bookmark

* counsel.el (counsel-bookmark): Add "other window" action
bookmark-jump-other-window, in line with similar actions for
counsel-find-file and ivy-switch-buffer (PR #2902).

Copyright-paperwork-exempt: yes
---
 counsel.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/counsel.el b/counsel.el
index c176820..2b33722 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2490,7 +2490,8 @@ By default `counsel-bookmark' opens a dired buffer for 
directories."
 
 (ivy-set-actions
  'counsel-bookmark
- `(("d" bookmark-delete "delete")
+ `(("j" bookmark-jump-other-window "other window")
+   ("d" bookmark-delete "delete")
("e" bookmark-rename "edit")
("s" bookmark-set "overwrite")
("x" ,(counsel--apply-bookmark-fn #'counsel-find-file-extern)



[elpa] externals/counsel d2f290a 2/3: Merge branch 'master' into externals/counsel

2021-08-02 Thread Basil L. Contovounesios
branch: externals/counsel
commit d2f290afbff36aecc3cd4408704149c6d8b5580d
Merge: ba18ac9 bde2176
Author: Basil L. Contovounesios 
Commit: Basil L. Contovounesios 

Merge branch 'master' into externals/counsel
---
 .github/workflows/test.yml | 52 ++
 counsel.el |  3 ++-
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 000..11e6514
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,52 @@
+name: CI
+on:
+  pull_request:
+paths-ignore:
+- '**.md'
+- '**.org'
+- '.dir-locals.el'
+- '.elpaignore'
+- '.gitignore'
+- 'doc/**'
+branches:
+  - master
+  push:
+paths-ignore:
+- '**.md'
+- '**.org'
+- '.dir-locals.el'
+- '.elpaignore'
+- '.gitignore'
+- 'doc/**'
+
+jobs:
+  build:
+runs-on: ubuntu-latest
+strategy:
+  fail-fast: false
+  matrix:
+emacs_version:
+  - 24.5
+  - 25.1
+  - 25.2
+  - 25.3
+  - 26.1
+  - 26.2
+  - 26.3
+  - 27.1
+  - snapshot
+
+steps:
+- uses: purcell/setup-emacs@master
+  with:
+version: ${{ matrix.emacs_version }}
+
+- uses: actions/checkout@v2
+
+- name: Check Emacs version
+  run: emacs --version
+
+- name: Test
+  run: |
+make deps
+make test
diff --git a/counsel.el b/counsel.el
index c176820..2b33722 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2490,7 +2490,8 @@ By default `counsel-bookmark' opens a dired buffer for 
directories."
 
 (ivy-set-actions
  'counsel-bookmark
- `(("d" bookmark-delete "delete")
+ `(("j" bookmark-jump-other-window "other window")
+   ("d" bookmark-delete "delete")
("e" bookmark-rename "edit")
("s" bookmark-set "overwrite")
("x" ,(counsel--apply-bookmark-fn #'counsel-find-file-extern)



[elpa] externals/consult 56d65df: consult-recent-file: Fix docstring

2021-08-02 Thread ELPA Syncer
branch: externals/consult
commit 56d65dfcfe07279d86c12aac34647bd2e95d65ea
Author: Daniel Mendler 
Commit: Daniel Mendler 

consult-recent-file: Fix docstring
---
 consult.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/consult.el b/consult.el
index 5955092..b06ff08 100644
--- a/consult.el
+++ b/consult.el
@@ -2975,7 +2975,7 @@ narrowing and the settings `consult-goto-line-numbers' and
 
 ;;;###autoload
 (defun consult-recent-file ()
-  "Find recent using `completing-read'."
+  "Find recent file using `completing-read'."
   (interactive)
   (find-file
(consult--read



[elpa] externals/consult e3418a9: Update changelog

2021-08-02 Thread ELPA Syncer
branch: externals/consult
commit e3418a995a48e221a022693c17e6b786933c
Author: Daniel Mendler 
Commit: Daniel Mendler 

Update changelog
---
 CHANGELOG.org | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index 5798472..7483d89 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -9,6 +9,7 @@
 - Rename =consult-project-imenu= to =consult-imenu-multi=
 - Add =consult-line-multi= to search multiple buffers
 - Removed obsolete =consult-yank=, =consult-async-default-split=, 
=consult-config=
+- =consult-ripgrep=: Use =--smart-case=
 
 * Version 0.9 (2021-06-22)
 



[elpa] externals/company 42ede0f 1/2: Allow Control quick-access modifier key

2021-08-02 Thread ELPA Syncer
branch: externals/company
commit 42ede0fadd023ffa8155ed736098aa84c6ccf048
Author: YE 
Commit: YE 

Allow Control quick-access modifier key
---
 company.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/company.el b/company.el
index dd15fb5..afb0c76 100644
--- a/company.el
+++ b/company.el
@@ -692,7 +692,8 @@ See `company-quick-access-keys' for more details."
   :set #'company-custom--set-quick-access
   :type '(choice (const :tag "Meta key" meta)
  (const :tag "Super key" super)
- (const :tag "Hyper key" hyper))
+ (const :tag "Hyper key" hyper)
+ (const :tag "Control key" control))
   :package-version '(company . "0.9.14"))
 
 (defun company-keymap--quick-access-modifier ()
@@ -700,7 +701,8 @@ See `company-quick-access-keys' for more details."
   (if-let ((modifier (assoc-default company-quick-access-modifier
 '((meta . "M")
   (super . "s")
-  (hyper . "H")
+  (hyper . "H")
+  (control . "C")
   modifier
 (warn "company-quick-access-modifier value unknown: %S"
   company-quick-access-modifier)



[elpa] externals/company a3e4879 2/2: Merge pull request #1157 from yugaego/quick-access

2021-08-02 Thread ELPA Syncer
branch: externals/company
commit a3e487966f7e116a328aa5764ab907c1f7729d21
Merge: 824b5fd 42ede0f
Author: Dmitry Gutov 
Commit: GitHub 

Merge pull request #1157 from yugaego/quick-access

Allow Control quick-access modifier key
---
 company.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/company.el b/company.el
index a0313b1..d35698f 100644
--- a/company.el
+++ b/company.el
@@ -692,7 +692,8 @@ See `company-quick-access-keys' for more details."
   :set #'company-custom--set-quick-access
   :type '(choice (const :tag "Meta key" meta)
  (const :tag "Super key" super)
- (const :tag "Hyper key" hyper))
+ (const :tag "Hyper key" hyper)
+ (const :tag "Control key" control))
   :package-version '(company . "0.9.14"))
 
 (defun company-keymap--quick-access-modifier ()
@@ -700,7 +701,8 @@ See `company-quick-access-keys' for more details."
   (if-let ((modifier (assoc-default company-quick-access-modifier
 '((meta . "M")
   (super . "s")
-  (hyper . "H")
+  (hyper . "H")
+  (control . "C")
   modifier
 (warn "company-quick-access-modifier value unknown: %S"
   company-quick-access-modifier)



[elpa] externals/emms 8b32529: * emms-player-mpd.el: fix cache issues with MPD

2021-08-02 Thread ELPA Syncer
branch: externals/emms
commit 8b32529950e5a2e1dd7afed8757ff6bc923c95e2
Author: Yoni Rabkin 
Commit: Yoni Rabkin 

* emms-player-mpd.el: fix cache issues with MPD

Patch by Pavel Korytov. Too short to require copyright assignment.
---
 AUTHORS|   7 +-
 emms-player-mpd.el | 842 ++---
 2 files changed, 425 insertions(+), 424 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 71e540c..3066a76 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -42,14 +42,15 @@ Fran Burstall
 
 
 The following is a list of people who contributed trivial patches,
-which is to say very simple patches and those with total of 12 lines
-or fewer. We started recording trivial patches this way in June of
-2017, so trivial patches before that date would not appear below.
+which is to say, simple patches and those with total of 12 lines or
+fewer. We started recording trivial patches this way in June of 2017,
+so trivial patches before that date would not appear below.
 
 David Michael
 tumashu
 Maxim Cournoyer
 Ian Dunn
+Pavel Korytov
 
 
 ;; Local variables:
diff --git a/emms-player-mpd.el b/emms-player-mpd.el
index e7a61a0..5ac48fa 100644
--- a/emms-player-mpd.el
+++ b/emms-player-mpd.el
@@ -113,8 +113,8 @@
 (eval-when-compile
   (condition-case nil
   (progn
-(require 'url)   ; load if available
-(require 'emms-url))
+   (require 'url)   ; load if available
+   (require 'emms-url))
 (error nil)))
 
 (defgroup emms-player-mpd nil
@@ -123,8 +123,8 @@
   :prefix "emms-player-mpd-")
 
 (defcustom emms-player-mpd (emms-player #'emms-player-mpd-start
-#'emms-player-mpd-stop
-#'emms-player-mpd-playable-p)
+   #'emms-player-mpd-stop
+   #'emms-player-mpd-playable-p)
   "Parameters for the MusicPD player."
   :type '(cons symbol alist))
 
@@ -137,8 +137,8 @@ config."
   ;; The :format part ensures that entering directories happens on the
   ;; next line, where there is more space to work with
   :type '(choice :format "%{%t%}:\n   %[Value Menu%] %v"
- (const nil)
- directory))
+(const nil)
+directory))
 
 (defun emms-player-mpd-get-supported-regexp ()
   "Returns a regexp of file extensions that MusicPD supports,
@@ -146,55 +146,55 @@ or nil if we cannot figure it out."
   (let ((out (shell-command-to-string "mpd --version")))
 ;; 0.17.x
 (if (string-match "Decoders plugins:$" out)
-(let* ((b (match-end 0))
-   (e (string-match "Output plugins:$" out))
-   (plugs (split-string (substring out b e) "\n" t))
-   (plugs (cl-mapcan (lambda (x)
-   (and (string-match " +\\[.*\\] +\\(.+\\)$" 
x)
-(split-string (match-string 1 x) nil 
t)))
- plugs))
-   (b (and (string-match "Protocols:$" out) (match-end 0)))
-   (prots (and b (substring out (+ 2 b) -1)))
-   (prots (split-string (or prots "") nil t)))
-  (concat "\\(\\.\\(m3u\\|pls\\|"
-  (regexp-opt (delq nil plugs))
-  "\\)\\'\\)\\|\\(\\`"
-  (regexp-opt (delete "file://" prots)) "\\)"))
+   (let* ((b (match-end 0))
+  (e (string-match "Output plugins:$" out))
+  (plugs (split-string (substring out b e) "\n" t))
+  (plugs (cl-mapcan (lambda (x)
+  (and (string-match " +\\[.*\\] +\\(.+\\)$" x)
+   (split-string (match-string 1 x) nil 
t)))
+plugs))
+  (b (and (string-match "Protocols:$" out) (match-end 0)))
+  (prots (and b (substring out (+ 2 b) -1)))
+  (prots (split-string (or prots "") nil t)))
+ (concat "\\(\\.\\(m3u\\|pls\\|"
+ (regexp-opt (delq nil plugs))
+ "\\)\\'\\)\\|\\(\\`"
+ (regexp-opt (delete "file://" prots)) "\\)"))
   (let ((found-start nil)
-(supported nil))
-(if (string-match "Supported decoders:\\([^0]+?\\)Supported outputs:" 
out)
-;; 0.15.x
-(setq supported (replace-regexp-in-string "\\[.+?\\]" ""
-  (match-string 1 out)))
-  ;; < 0.15
-  (setq out (split-string out "\n"))
-  (while (car out)
-(cond ((string= (car out) "Supported formats:")
-   (setq found-start t))
-  ((string= (car out) "")
-   (setq found-start nil))
-  (found-start
-   (setq supported (concat supported (car out)
-(setq out (cdr out
-;; Create regexp
-(when (a

[elpa] scratch/javaimp-wip 551b1a3: wip

2021-08-02 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit 551b1a3a270612b06fec2db36026b1acebfe078d
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp-gradle.el |  10 -
 javaimp-maven.el  |  11 +-
 javaimp-parse.el  |  89 +-
 javaimp-util.el   |  59 ++--
 javaimp.el| 115 +-
 5 files changed, 199 insertions(+), 85 deletions(-)

diff --git a/javaimp-gradle.el b/javaimp-gradle.el
index 85e3f2e..e99aab7 100644
--- a/javaimp-gradle.el
+++ b/javaimp-gradle.el
@@ -48,7 +48,15 @@ information."
 (javaimp--gradle-module-from-alist alist file))
   alists)))
 ;; first module is always root
-(javaimp--build-tree (car modules) nil modules)))
+(message "Building tree for root: %s"
+ (javaimp-print-id (javaimp-module-id (car modules
+(javaimp--build-tree (car modules) modules
+;; more or less reliable way to find children
+;; is to look for modules with "this" as the
+;; parent
+ (lambda (el tested)
+   (equal (javaimp-module-parent-id tested)
+  (javaimp-module-id el))
 
 (defun javaimp--gradle-handler ()
   (goto-char (point-min))
diff --git a/javaimp-maven.el b/javaimp-maven.el
index eee886f..e2c2118 100644
--- a/javaimp-maven.el
+++ b/javaimp-maven.el
@@ -87,7 +87,16 @@ resulting module trees."
  modules)))
(cdr modules)
   (mapcar (lambda (root)
-(javaimp--build-tree root nil modules))
+(message "Building tree for root: %s"
+ (javaimp-print-id (javaimp-module-id root)))
+(javaimp--build-tree
+  root modules
+ ;; more or less reliable way to find
+ ;; children is to look for modules with
+ ;; "this" as the parent
+  (lambda (el tested)
+(equal (javaimp-module-parent-id tested)
+   (javaimp-module-id el)
   roots
 
 (defun javaimp--maven-effective-pom-handler ()
diff --git a/javaimp-parse.el b/javaimp-parse.el
index db58e0e..ca8a77c 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -37,17 +37,19 @@ present."
; method, statement, simple-statement, array, unknown
   name
   start
-  open-brace)
+  open-brace
+  parent)
 
-(defconst javaimp--parse-class-keywords
+(defconst javaimp--parse-classlike-keywords
   '("class" "interface" "enum"))
 (defconst javaimp--parse-stmt-keywords
   '("if" "for" "while" "switch" "try" "catch" "finally"
 "static";static initializer block
 ))
 
-(defsubst javaimp--parse-is-class (scope)
-  (member (symbol-name (javaimp-scope-type scope)) 
javaimp--parse-class-keywords))
+(defsubst javaimp--parse-is-classlike (scope)
+  (member (symbol-name (javaimp-scope-type scope))
+  javaimp--parse-classlike-keywords))
 
 (defvar javaimp--arglist-syntax-table
   (let ((st (make-syntax-table java-mode-syntax-table))) ;TODO don't depend
@@ -265,7 +267,7 @@ is unchanged."
   "Attempts to parse 'class' / 'interface' / 'enum' scope.  Some of
 those may later become 'local-class' (see `javaimp--parse-scopes')."
   (save-excursion
-(if (javaimp--parse-preceding (regexp-opt javaimp--parse-class-keywords 
'words)
+(if (javaimp--parse-preceding (regexp-opt 
javaimp--parse-classlike-keywords 'words)
   (nth 1 state))
 (let* ((keyword-start (match-beginning 1))
(keyword-end (match-end 1))
@@ -394,7 +396,7 @@ nil then goes all the way up.  Examines and sets property
 ;; find innermost enclosing open-bracket
 (goto-char (nth 1 state))
 (when (= (char-after) ?{)
-  (let ((scope (get-text-property 'javaimp-parse-scope)))
+  (let ((scope (get-text-property (point) 'javaimp-parse-scope)))
 (unless scope
   (setq scope (run-hook-with-args-until-success
'javaimp--parse-scope-hook state))
@@ -407,15 +409,27 @@ nil then goes all the way up.  Examines and sets property
 ;; if a class is enclosed in anything other than a class, then it
 ;; should be local
 (let ((tmp res)
-  in-local)
+  in-local parent)
   (while tmp
-(if (javaimp--parse-is-class (car tmp))
+(if (javaimp--parse-is-classlike (car tmp))
 (when in-local
   (setf (javaimp-scope-type (car tmp)) 'local-class))
   (setq in-local t))
+(setf (javaimp-scope-parent (car tmp)) parent)
+(setq parent (car tmp))
 (setq tmp (cdr tmp
 

[elpa] scratch/javaimp-wip a5c00a7: wip

2021-08-02 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit a5c00a78f0ca60e73b869775e72ade87ff204996
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/javaimp.el b/javaimp.el
index 3efdae4..5b887fb 100644
--- a/javaimp.el
+++ b/javaimp.el
@@ -576,7 +576,10 @@ is `ordinary' or `static'.  Interactively, NEW-IMPORTS is 
nil."
 
 ;;;###autoload
 (defun javaimp-imenu-create-index ()
-  (let ((forest (javaimp--parse-get-forest-for-imenu)))
+  (let ((forest (save-excursion
+  (javaimp--parse-clean-all-scopes)
+  (javaimp--parse-all-scopes)
+  (javaimp--parse-get-forest-for-imenu
 (cond ((not javaimp-imenu-group-methods)
;; just plain list of methods
(javaimp--collect-nodes



[elpa] externals/ftable 2b08dc9 01/14: Init

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 2b08dc96d287517d02bf49c1ca785e765a92f0fb
Author: Yuan Fu 
Commit: Yuan Fu 

Init

* README.org: New file.
* ftable.gif: New file.
* ftable.el: New file.
---
 README.org |  23 +++
 ftable.el  | 626 +
 ftable.gif | Bin 0 -> 368933 bytes
 3 files changed, 649 insertions(+)

diff --git a/README.org b/README.org
new file mode 100644
index 000..5f68a96
--- /dev/null
+++ b/README.org
@@ -0,0 +1,23 @@
+#+TITLE: ftable.el
+
+This package provides some convenient commands for filling a table, i.e., 
adjusting the layout of the table so it can fit in n columns.
+
+[[./ftable.gif]]
+
+Commands provided:
+
+- ftable-fill :: Fill the table at point
+- ftable-reformat :: Change the style of the table. For example, from
+#+begin_example
+ASCII +--+--+ to Unicode ┌──┬──┐
+  |  |  |│  │  │
+  +--+--+└──┴──┘
+#+end_example
+
+- ftable-edit-cell :: Edit the cell at point
+
+There are some limitations. Currently ftable doesn’t support tables with 
compound cells (cells that span multiple rows/columns) because they are more 
complicated to handle. If the need arises in the future (unlikely), I might 
improve ftable to handle more complex tables. Also, after filling, any manual 
line breaks in a cell is discarded.
+
+* Customization
+
+- ftable-fill-column :: ~fill-column~ for ftable.
diff --git a/ftable.el b/ftable.el
new file mode 100644
index 000..df01b4d
--- /dev/null
+++ b/ftable.el
@@ -0,0 +1,626 @@
+;;; ftable.el --- Fill a table to fit in n columns  -*- lexical-binding: 
t; -*-
+
+;; Author: Yuan Fu 
+
+;;; This file is NOT part of GNU Emacs
+
+;;; Commentary:
+;;
+;; This package provides some convenient commands for filling a table,
+;; i.e., adjusting the layout of the table so it can fit in n columns.
+;;
+;; Commands provided:
+;;
+;; - ftable-fill   Fill the table at point
+;; - ftable-reformat   Change the style of the table. For example, from
+;; ASCII +--+--+ to Unicode ┌──┬──┐
+;;   |  |  |│  │  │
+;;   +--+--+└──┴──┘
+;; - ftable-edit-cell  Edit the cell at point
+;;
+;; There are some limitations. Currently ftable doesn’t support tables
+;; with compound cells (cells that span multiple rows/columns) because
+;; they are more complicated to handle. If the need arises in the
+;; future (unlikely), I might improve ftable to handle more complex
+;; tables. Also, after filling, any manual line breaks in a cell is
+;; discarded.
+;;
+;; Customization:
+;;
+;; - ftable-fill-column
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'cl-generic)
+(require 'pcase)
+;; (require 'fill) fill.el doesn’t have a provide form.
+
+;;; Customization
+
+(defvar-local ftable-fill-column fill-column
+  "Basically `fill-column' for fill-table.")
+
+;;; Table structure
+
+(cl-defstruct ftable
+  "A table.
+
+COLUMN-WIDTH-LIST  A list that records the width (in characters)
+   of each column.
+MIN-WIDTH-LIST A list that records the minimum width (in
+   characters) of each column.
+CELL-MATRIXA list of list of strings. Each string is a cell.
+   Cells don’t contain newlines.
+
+Each cell is a string, the cell doesn’t contain newlines. Column
+width can be smaller than the string length of a cell, in which
+case means the line cell is filled to that width."
+  column-width-list
+  min-width-list
+  matrix)
+
+(cl-deftype ftable-cell () '(satisfies stringp))
+
+(cl-defmethod ftable--row-count ((table ftable))
+  "Return the number of rows in TABLE."
+  (length (ftable-matrix table)))
+
+(cl-defmethod ftable--column-count ((table ftable))
+  "Return the number of columns in TABLE."
+  (length (car (ftable-matrix table
+
+;;; Parse
+;;
+;; Transforming between text and table structure
+
+(defvar ftable-box-charset-alist
+  '((ascii . "
++-++
+| ||
++-++
++-++")
+(unicode . "
+┌─┬┐
+│ ││
+├─┼┤
+└─┴┘"))
+  "An alist of (NAME . CHARSET).
+A charset tells ftable how to parse the table. I.e., what are the
+box drawing characters to use. Don’t forget the first newline.
+NAME is the mnemonic for that charset.")
+
+(defun ftable-box-char (code charset)
+  "Return a specific box drawing character in CHARSET.
+
+Return a string. CHARSET should be like `ftable-box-char-set'.
+Mapping between CODE and position:
+
+┌┬┐ 123
+├┼┤ <-> 456
+└┴┘ 789
+   
+┌─┐ 1 H 3H: horizontal
+│ │ <-> V   VV: vertical
+└─┘ 7 H 9
+
+Examples:
+
+(ftable-box-char 'h charset) => \"─\"
+(ftable-box-char 2 charset)  => \"┬\""
+  (let ((index (pcase code
+ ('h 10)
+ ('v 11)
+ ('n 12)
+ ('s 13)
+ (_ code
+
+(char-to-string
+ (aref charset ;1 2 3 4  5  6 

[elpa] branch externals/ftable created (now 96a0475)

2021-08-02 Thread monnier--- via
monnier pushed a change to branch externals/ftable.

at  96a0475   Prepare for ELPA

This branch includes the following new commits:

   new  2b08dc9   Init
   new  8ff305b   Not use forward-paragraph
   new  a647832   xx
   new  63fb0ac   Add checks for parsing
   new  d2385e3   * ftable.el (ftable-misc-test): Fix test.
   new  ec019c2   Add customization
   new  9c13bfc   Add table.el intergration
   new  9f75340   Make ftable work with CJK characters
   new  33b32ba   * ftable.el (ftable-edit-cell): Fix typos.
   new  e029b2f   * ftable.el: Add a workaround.
   new  1ea20be   Allow non-table lines before and after table
   new  71dcbd0   Fix beginning- and end-of-table function
   new  939cc1b   Fix typo
   new  96a0475   Prepare for ELPA




[elpa] externals/ftable ec019c2 06/14: Add customization

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit ec019c2d81e89d1dd7768df285f3d3b7fab7e3c6
Author: Yuan Fu 
Commit: Yuan Fu 

Add customization

* README.org: Fix typo.
* ftable.el (ftable): New custom group.
(ftable-fill-column): Change to a custom option.
(ftable-recognize-table): New custom option.
---
 README.org |  2 +-
 ftable.el  | 18 +++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 5f68a96..c70c26e 100644
--- a/README.org
+++ b/README.org
@@ -16,7 +16,7 @@ Commands provided:
 
 - ftable-edit-cell :: Edit the cell at point
 
-There are some limitations. Currently ftable doesn’t support tables with 
compound cells (cells that span multiple rows/columns) because they are more 
complicated to handle. If the need arises in the future (unlikely), I might 
improve ftable to handle more complex tables. Also, after filling, any manual 
line breaks in a cell is discarded.
+There are some limitations. Currently ftable doesn’t support tables with 
compound cells (cells that span multiple rows/columns) because they are more 
complicated to handle. If the need arises in the future (unlikely), I might 
improve ftable to handle more complex tables. Also, after filling, any manual 
line-break in a cell is discarded.
 
 * Customization
 
diff --git a/ftable.el b/ftable.el
index 7812924..09db7d5 100644
--- a/ftable.el
+++ b/ftable.el
@@ -22,7 +22,7 @@
 ;; with compound cells (cells that span multiple rows/columns) because
 ;; they are more complicated to handle. If the need arises in the
 ;; future (unlikely), I might improve ftable to handle more complex
-;; tables. Also, after filling, any manual line breaks in a cell is
+;; tables. Also, after filling, any manual line-break in a cell is
 ;; discarded.
 ;;
 ;; Customization:
@@ -38,8 +38,20 @@
 
 ;;; Customization
 
-(defvar-local ftable-fill-column fill-column
-  "Basically `fill-column' for fill-table.")
+(defgroup ftable
+  '((ftable-fill-column custom-variable)
+(ftable-recognize-table custom-variable))
+  "Fill (auto-layout) tables."
+  :group 'text)
+
+(defcustom ftable-fill-column fill-column
+  "Basically `fill-column' for fill-table."
+  :local t
+  :type 'number)
+
+(defcustom ftable-recognize-table nil
+  "When non-nil, ftable calls `table-recognize' on the table."
+  :type 'boolean)
 
 ;;; Table structure
 



[elpa] externals/ftable 33b32ba 09/14: * ftable.el (ftable-edit-cell): Fix typos.

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 33b32ba7967fe68be42a907cb003d2e7bd90c3b0
Author: Yuan Fu 
Commit: Yuan Fu 

* ftable.el (ftable-edit-cell): Fix typos.
---
 ftable.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ftable.el b/ftable.el
index 5af7eda..13caf2f 100644
--- a/ftable.el
+++ b/ftable.el
@@ -45,7 +45,7 @@
   :group 'text)
 
 (defcustom ftable-fill-column fill-column
-  "Basically `fill-column' for fill-table."
+  "Basically `fill-column' for ftable."
   :local t
   :type 'number)
 
@@ -513,7 +513,7 @@ Return a new string."
   (interactive)
   (pcase-let* ((pt (point))
(p-column (- (point) (line-beginning-position)))
-   (`(,text ,beg ,end cell-p,tablep ,charset)
+   (`(,text ,beg ,end ,cell-p,tablep ,charset)
 (ftable--table-info))
(x -1)
;; If these two characters are the same, we will count



[elpa] externals/ftable d2385e3 05/14: * ftable.el (ftable-misc-test): Fix test.

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit d2385e3216e536a903833212ac1318d806ecec26
Author: Yuan Fu 
Commit: Yuan Fu 

* ftable.el (ftable-misc-test): Fix test.
---
 ftable.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ftable.el b/ftable.el
index 84e3a3e..7812924 100644
--- a/ftable.el
+++ b/ftable.el
@@ -616,7 +616,7 @@ charset used by the table (if there is a table).
'( "│ab│c│" "│de│f│" "│gh│i│"))
'(("ab" "c") ("de" "f") ("gh" "i") )))
 (should (equal (ftable--tokenize-line
-"|fgh|  | z|" (cdadr ftable-box-charset-alist))
+"|fgh|  | z|" (cdar ftable-box-charset-alist))
'("fgh" "" "z")))
 ;; ftable--merge-lines
 (should (equal (mapcar #'ftable--merge-lines



[elpa] externals/ftable 9f75340 08/14: Make ftable work with CJK characters

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 9f7534079c60c62a9e7256faf9a6726202404982
Author: Yuan Fu 
Commit: Yuan Fu 

Make ftable work with CJK characters

* ftable.el (ftable--parse-to, ftable--max-line-width,
ftable--pad-to): Replace 'length' with 'string-width'.
---
 ftable.el | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ftable.el b/ftable.el
index ca418b3..5af7eda 100644
--- a/ftable.el
+++ b/ftable.el
@@ -189,7 +189,7 @@ It defaults to the first charset."
 (make-ftable
  :column-width-list
  (mapcar (lambda (column)
-   (apply #'max (mapcar #'length column)))
+   (apply #'max (mapcar #'string-width column)))
  (cl-loop for n from 0 to (1- (length (car matrix)))
   collect (ftable--nth-column n matrix)))
  :min-width-list
@@ -264,7 +264,6 @@ Assumes each line in LINE-LIST has the same length."
 (cl-loop for col from 0 to (1- (length (car matrix)))
  collect (ftable--nth-column col matrix)
 
-
 ;;; Fill
 
 (cl-defmethod ftable--fill ((table ftable) table-max-width)
@@ -365,7 +364,7 @@ Return a new table with shrinked column."
 (defun ftable--max-line-width ()
   "Return the maximum line width in buffer."
   (apply #'max
- (mapcar #'length
+ (mapcar #'string-width
  (split-string (buffer-string) "\n"
 
 ;;; Unparse
@@ -485,8 +484,8 @@ which corresponds to
 (defun ftable--pad-to (text width)
   "Append padding to TEXT until it is WIDTH characters long.
 Return a new string."
-  (if (< (length text) width)
-  (concat text (make-vector (- width (length text)) ?\s))
+  (if (< (string-width text) width)
+  (concat text (make-vector (- width (string-width text)) ?\s))
 text))
 
 ;;; Convenience



[elpa] externals/ftable 71dcbd0 12/14: Fix beginning- and end-of-table function

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 71dcbd0593610386f60f2540b5511f7ca5adb0b4
Author: Yuan Fu 
Commit: Yuan Fu 

Fix beginning- and end-of-table function

* ftable.el (ftable--beginning-of-table, ftable--end-of-table): Don't
move point if not at a table.
---
 ftable.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ftable.el b/ftable.el
index 27178dc..4def264 100644
--- a/ftable.el
+++ b/ftable.el
@@ -595,7 +595,8 @@ Assumes point is on a table."
   ;; This implementation allows non-table lines before a table, e.g.,
   ;; #+latex: xxx
   ;; |--+|
-  (beginning-of-line)
+  (when (ftable--at-table-p)
+(beginning-of-line))
   (while (and (< (point-min) (point))
   (ftable--at-table-p))
 (forward-line -1))
@@ -606,7 +607,8 @@ Assumes point is on a table."
   "Go forward to the end of the table at point.
 Assumes point is on a table."
   (let ((start (point)))
-(beginning-of-line)
+(when (ftable--at-table-p)
+  (beginning-of-line))
 (while (and (< (point) (point-max))
 (ftable--at-table-p))
   (forward-line 1))



[elpa] externals/ftable 939cc1b 13/14: Fix typo

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 939cc1bc0a272e9b3bca4e1f6bd077e4754fb8ea
Author: Yuan Fu 
Commit: Yuan Fu 

Fix typo

* ftable.el (ftable--at-table-p, ftable--beginning-of-table): Change
valign to ftable.
---
 ftable.el | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ftable.el b/ftable.el
index 4def264..c587e84 100644
--- a/ftable.el
+++ b/ftable.el
@@ -584,10 +584,10 @@ STYLE can be ’ascii or ’unicode."
 (append
  (cl-loop for elt in ftable-box-charset-alist
   for charset = (cdr elt)
-  collect (valign-box-char 1 charset)
-  collect (valign-box-char 4 charset)
-  collect (valign-box-char 7 charset)
-  collect (valign-box-char 'v charset))
+  collect (ftable-box-char 1 charset)
+  collect (ftable-box-char 4 charset)
+  collect (ftable-box-char 7 charset)
+  collect (ftable-box-char 'v charset))
 
 (defun ftable--beginning-of-table ()
   "Go backward to the beginning of the table at point.
@@ -600,7 +600,7 @@ Assumes point is on a table."
   (while (and (< (point-min) (point))
   (ftable--at-table-p))
 (forward-line -1))
-  (unless (valign--at-table-p)
+  (unless (ftable--at-table-p)
 (forward-line 1)))
 
 (defun ftable--end-of-table ()



[elpa] externals/ftable a647832 03/14: xx

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit a647832418e4a36392f27157fbccc1ade1f8525f
Author: Yuan Fu 
Commit: Yuan Fu 

xx
---
 ftable.el | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ftable.el b/ftable.el
index 6c33b9f..57c0beb 100644
--- a/ftable.el
+++ b/ftable.el
@@ -550,12 +550,14 @@ position of the table, not including any newlines. TABLEP 
is t if
 point is on a table, nil if not. CHARSET is the box drawing
 charset used by the table (if there is a table).
 \(See `ftable-box-charset-alist'.)"
-  (let* ((beg (save-excursion (search-backward "\n\n" nil t)
+  (let* ((beg (save-excursion (if (not (search-backward "\n\n" nil t))
+  (point-min))
   (skip-chars-forward "\n")
   (point)))
- (end (save-excursion (search-forward "\n\n" nil t)
-  (skip-chars-backward "\n")
-  (point)))
+ (end (save-excursion (if (not (search-forward "\n\n" nil t))
+  (point-max)
+(skip-chars-backward "\n")
+(point
  (text (buffer-substring-no-properties
 beg end)))
 (append (list text beg end)



[elpa] externals/ftable 8ff305b 02/14: Not use forward-paragraph

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 8ff305be0936de0c7ed9e691684aa1ae9be241ff
Author: Yuan Fu 
Commit: Yuan Fu 

Not use forward-paragraph

Sometimes it doesn't work.

* ftable.el (ftable--table-info): Change 'forward-paragraph' to
'search-forward'.
---
 ftable.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ftable.el b/ftable.el
index df01b4d..6c33b9f 100644
--- a/ftable.el
+++ b/ftable.el
@@ -550,10 +550,10 @@ position of the table, not including any newlines. TABLEP 
is t if
 point is on a table, nil if not. CHARSET is the box drawing
 charset used by the table (if there is a table).
 \(See `ftable-box-charset-alist'.)"
-  (let* ((beg (save-excursion (forward-paragraph -1)
+  (let* ((beg (save-excursion (search-backward "\n\n" nil t)
   (skip-chars-forward "\n")
   (point)))
- (end (save-excursion (forward-paragraph 1)
+ (end (save-excursion (search-forward "\n\n" nil t)
   (skip-chars-backward "\n")
   (point)))
  (text (buffer-substring-no-properties



[elpa] externals/ftable 9c13bfc 07/14: Add table.el intergration

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 9c13bfc27b65bf4d47b5f1f49d1f59292439d6d1
Author: Yuan Fu 
Commit: Yuan Fu 

Add table.el intergration

* ftable.el (ftable-recognize-table): Remove custom option.
(ftable-fill, ftable-edit-cell, ftable-reformat): Run
'table-recognize' after edit if the table is managed by table.el.
(ftable--replace-text): Add a new parameter FN.
(ftable--table-info): Return a new information: table-cell-p.  This
tells the caller if the table is managed by table.el
---
 ftable.el | 50 +-
 1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/ftable.el b/ftable.el
index 09db7d5..ca418b3 100644
--- a/ftable.el
+++ b/ftable.el
@@ -49,10 +49,6 @@
   :local t
   :type 'number)
 
-(defcustom ftable-recognize-table nil
-  "When non-nil, ftable calls `table-recognize' on the table."
-  :type 'boolean)
-
 ;;; Table structure
 
 (cl-defstruct ftable
@@ -498,7 +494,7 @@ Return a new string."
 (defun ftable-fill ()
   "Fill the table (or paragraph) at point."
   (interactive)
-  (pcase-let ((`(,text ,beg ,end ,tablep , charset)
+  (pcase-let ((`(,text ,beg ,end ,cell-p ,tablep , charset)
(ftable--table-info)))
 (if tablep
 (ftable--replace-text
@@ -508,7 +504,9 @@ Return a new string."
(ftable--fill (ftable--parse-to
   'ftable text charset)
  ftable-fill-column)
-   charset)))
+   charset))
+ (when cell-p
+   #'table-recognize-region))
   (fill-paragraph
 
 (defun ftable-edit-cell ()
@@ -516,7 +514,8 @@ Return a new string."
   (interactive)
   (pcase-let* ((pt (point))
(p-column (- (point) (line-beginning-position)))
-   (`(,text ,beg ,end ,tablep ,charset) (ftable--table-info))
+   (`(,text ,beg ,end cell-p,tablep ,charset)
+(ftable--table-info))
(x -1)
;; If these two characters are the same, we will count
;; one extra.
@@ -546,7 +545,9 @@ Return a new string."
  beg end text
  (ftable--unparse
   (ftable--fill table ftable-fill-column)
-  charset))
+  charset)
+ (when cell-p
+   #'table-recognize-region))
 
 (defun ftable-reformat (style)
   "Change box drawing STYLE for table at point.
@@ -555,7 +556,7 @@ STYLE can be ’ascii or ’unicode."
   (downcase
(completing-read "Style: "
 '("ASCII" "Unicode"))
-  (pcase-let ((`(,text ,beg ,end ,tablep ,charset)
+  (pcase-let ((`(,text ,beg ,end ,cell-p ,tablep ,charset)
(ftable--table-info)))
 (if (not tablep)
 (user-error "There is no table at point")
@@ -567,15 +568,18 @@ STYLE can be ’ascii or ’unicode."
 (ftable--fill
  (ftable--parse-to 'ftable text charset)
  ftable-fill-column)
-(alist-get style ftable-box-charset-alist))
+(alist-get style ftable-box-charset-alist))
+   (when cell-p
+ #'table-recognize-region)
 
 (defun ftable--table-info ()
-  "Return (TEXT BEG END TABLEP CHARSET) for the table at point.
+  "Return (TEXT BEG END TABLE-CELL-P TABLEP CHARSET).
 TEXT is the table’s text. BEG and END are the beginning and end
-position of the table, not including any newlines. TABLEP is t if
-point is on a table, nil if not. CHARSET is the box drawing
-charset used by the table (if there is a table).
-\(See `ftable-box-charset-alist'.)"
+position of the table, not including any newlines. TABLE-CELL-P
+is t if the table is managed by table.el. TABLEP is t if point is
+on a table, nil if not. CHARSET is the box drawing charset used
+by the table (if there is a table). \(See
+`ftable-box-charset-alist'.)"
   (let* ((beg (save-excursion (if (not (search-backward "\n\n" nil t))
   (point-min))
   (skip-chars-forward "\n")
@@ -584,9 +588,9 @@ charset used by the table (if there is a table).
   (point-max)
 (skip-chars-backward "\n")
 (point
- (text (buffer-substring-no-properties
-beg end)))
-(append (list text beg end)
+ (text (buffer-substring-no-properties beg end))
+ (table-cell-p (text-property-any beg end 'table-cell t)))
+(append (list text beg end table-cell-p)
 (cl-loop for charset
  in (mapcar #'cdr ftable-box-charset-alist)
  if (equal (substring text 0 1)
@@ -594,14 +598,18 @@ charset used by the table (if there is a table).
  return (list t charset)
  finally return (list nil nil)
 
-(defun ftable--replace-text (beg end text new-text)
-  "Replace TEXT between BEG and END with NEW-TEXT."
+(defun fta

[elpa] externals/ftable 1ea20be 11/14: Allow non-table lines before and after table

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 1ea20be274f278df3953cea4720f776adad43616
Author: Yuan Fu 
Commit: Yuan Fu 

Allow non-table lines before and after table

* ftable.el (ftable--at-table-p, ftable--beginning-of-table,
ftable--end-of-table): New functions.
(ftable--table-info): Use new functions.
---
 ftable.el | 54 ++
 1 file changed, 46 insertions(+), 8 deletions(-)

diff --git a/ftable.el b/ftable.el
index e0f8136..27178dc 100644
--- a/ftable.el
+++ b/ftable.el
@@ -575,6 +575,46 @@ STYLE can be ’ascii or ’unicode."
(when cell-p
  #'table-recognize-region)
 
+(defun ftable--at-table-p ()
+  "Return non-nil if point is in a table."
+  (save-excursion
+(beginning-of-line)
+(skip-chars-forward " \t")
+(member (char-to-string (char-after))
+(append
+ (cl-loop for elt in ftable-box-charset-alist
+  for charset = (cdr elt)
+  collect (valign-box-char 1 charset)
+  collect (valign-box-char 4 charset)
+  collect (valign-box-char 7 charset)
+  collect (valign-box-char 'v charset))
+
+(defun ftable--beginning-of-table ()
+  "Go backward to the beginning of the table at point.
+Assumes point is on a table."
+  ;; This implementation allows non-table lines before a table, e.g.,
+  ;; #+latex: xxx
+  ;; |--+|
+  (beginning-of-line)
+  (while (and (< (point-min) (point))
+  (ftable--at-table-p))
+(forward-line -1))
+  (unless (valign--at-table-p)
+(forward-line 1)))
+
+(defun ftable--end-of-table ()
+  "Go forward to the end of the table at point.
+Assumes point is on a table."
+  (let ((start (point)))
+(beginning-of-line)
+(while (and (< (point) (point-max))
+(ftable--at-table-p))
+  (forward-line 1))
+(unless (<= (point) start)
+  (skip-chars-backward "\n"))
+(when (< (point) start)
+  (error "End of table goes backwards"
+
 (defun ftable--table-info ()
   "Return (TEXT BEG END TABLE-CELL-P TABLEP CHARSET).
 TEXT is the table’s text. BEG and END are the beginning and end
@@ -583,14 +623,12 @@ is t if the table is managed by table.el. TABLEP is t if 
point is
 on a table, nil if not. CHARSET is the box drawing charset used
 by the table (if there is a table). \(See
 `ftable-box-charset-alist'.)"
-  (let* ((beg (save-excursion (if (not (search-backward "\n\n" nil t))
-  (point-min))
-  (skip-chars-forward "\n")
-  (point)))
- (end (save-excursion (if (not (search-forward "\n\n" nil t))
-  (point-max)
-(skip-chars-backward "\n")
-(point
+  (let* ((beg (save-excursion
+(ftable--beginning-of-table)
+(point)))
+ (end (save-excursion
+(ftable--end-of-table)
+(point)))
  (text (buffer-substring-no-properties beg end))
  (table-cell-p (text-property-any beg end 'table-cell t)))
 (append (list text beg end table-cell-p)



[elpa] externals/ftable 63fb0ac 04/14: Add checks for parsing

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 63fb0acc8409888b65b9206a7b0ec5d36ebb29b1
Author: Yuan Fu 
Commit: Yuan Fu 

Add checks for parsing

And removes an assertion.

* ftable.el (ftable-parse-error): New error.
(ftable--parse-to): Add dimension check.
(ftable--check-dimension): New function
(ftable--tokenize-line): Remove assertion.
---
 ftable.el | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/ftable.el b/ftable.el
index 57c0beb..84e3a3e 100644
--- a/ftable.el
+++ b/ftable.el
@@ -131,6 +131,8 @@ Examples:
 ;; 7 h 8 9 n))
 ;;   (insert (ftable-box-char code (cdadr ftable-box-charset-alist
 
+(define-error 'ftable-parse-error "Error parsing table")
+
 (cl-defmethod ftable--parse-to ((table-type (eql ftable)) text
 &optional box-charset)
   "Parse TEXT into a table of TABLE-TYPE.
@@ -166,6 +168,9 @@ It defaults to the first charset."
  (setq buffer nil))
 (push (ftable--tokenize-line line charset) buffer)))
 (setq matrix (reverse matrix))
+;; Sanity check.
+(when (not (ftable--check-dimension matrix))
+  (signal 'ftable-parse-error '("Dimension mismatch")))
 ;; MATRIX:
 ;; ((("ab" "c")) (("de" "f") ("gh" "i")))
 ;;
@@ -183,6 +188,17 @@ It defaults to the first charset."
  (ftable--min-column-width matrix)
  :matrix matrix)))
 
+(defun ftable--check-dimension (matrix)
+  "Check that the dimension of MATRIX is correct.
+Correct dimension means each row has the same number of columns.
+Return t if the dimension is correct, nil if not."
+  (let* ((matrix (apply #'append matrix))
+ (first-row-column-count (length (car matrix
+(cl-loop for row in (cdr matrix)
+ if (not (eq first-row-column-count (length row)))
+ return nil
+ finally return t)))
+
 (defun ftable--tokenize-line (text-line box-charset)
   "Tokenize TEXT-LINE into a list of tokens.
 
@@ -194,8 +210,6 @@ BOX-CHARSET is the same as in `ftable--parse-to'.
 
 Assumes each line begines with box drawing characters, i.e., no
 white space characters."
-  (cl-assert (string-prefix-p (ftable-box-char 'v box-charset) text-line)
- t "TEXT-LINE doesn’t begin with box drawing char")
   (mapcar #'string-trim
   (split-string (string-trim
  text-line



[elpa] externals/ftable e029b2f 10/14: * ftable.el: Add a workaround.

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit e029b2f4079643c3c5ed1ee7e629976613db6a62
Author: Yuan Fu 
Commit: Yuan Fu 

* ftable.el: Add a workaround.
---
 ftable.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/ftable.el b/ftable.el
index 13caf2f..e0f8136 100644
--- a/ftable.el
+++ b/ftable.el
@@ -49,6 +49,10 @@
   :local t
   :type 'number)
 
+;; KLUDGE: There seems to be a bug preventing ftable-fill-column to be
+;; set. (#44911)
+(setq ftable-fill-column fill-column)
+
 ;;; Table structure
 
 (cl-defstruct ftable



[elpa] externals/ftable 96a0475 14/14: Prepare for ELPA

2021-08-02 Thread monnier--- via
branch: externals/ftable
commit 96a0475871b1642582a0c0fb5a361a8af0dd5923
Author: Yuan Fu 
Commit: Yuan Fu 

Prepare for ELPA

* ftable.el (ftable): Remove custom options.
(ftable-fill, ftable-edit-cell, ftable-reformat): Add autoload cookie.
---
 ftable.el | 29 +
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/ftable.el b/ftable.el
index c587e84..71da62b 100644
--- a/ftable.el
+++ b/ftable.el
@@ -1,8 +1,28 @@
 ;;; ftable.el --- Fill a table to fit in n columns  -*- lexical-binding: 
t; -*-
 
+;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
+
 ;; Author: Yuan Fu 
+;; Maintainer: Yuan Fu 
+;; URL: https://github.com/casouri/ftable
+;; Version: 1.0
+;; Keywords: convenience, text, table
+;; Package-Requires: ((emacs "26.0"))
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
 
-;;; This file is NOT part of GNU Emacs
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see .
 
 ;;; Commentary:
 ;;
@@ -38,9 +58,7 @@
 
 ;;; Customization
 
-(defgroup ftable
-  '((ftable-fill-column custom-variable)
-(ftable-recognize-table custom-variable))
+(defgroup ftable nil
   "Fill (auto-layout) tables."
   :group 'text)
 
@@ -494,6 +512,7 @@ Return a new string."
 
 ;;; Convenience
 
+;;;###autoload
 (defun ftable-fill ()
   "Fill the table (or paragraph) at point."
   (interactive)
@@ -512,6 +531,7 @@ Return a new string."
#'table-recognize-region))
   (fill-paragraph
 
+;;;###autoload
 (defun ftable-edit-cell ()
   "Edit the cell at point."
   (interactive)
@@ -552,6 +572,7 @@ Return a new string."
  (when cell-p
#'table-recognize-region))
 
+;;;###autoload
 (defun ftable-reformat (style)
   "Change box drawing STYLE for table at point.
 STYLE can be ’ascii or ’unicode."



[elpa] main 06e2605: * elpa-packages (ftable): New package

2021-08-02 Thread monnier--- via
branch: main
commit 06e26055b33771c4ac7dd26e0f092de75b03d62c
Author: Stefan Monnier 
Commit: Stefan Monnier 

* elpa-packages (ftable): New package
---
 elpa-packages | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/elpa-packages b/elpa-packages
index 1d92d27..c355604 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -106,6 +106,7 @@
  ("cpio-mode"  :url "https://github.com/dlewan/cpio-mode";)
  ("crisp"  :url nil)
  ;; ("crossword"   :url 
"https://github.com/Boruch-Baum/emacs-crossword";)
+ ;; ("csharp-mode" :url 
"https://github.com/emacs-csharp/csharp-mode";)
  ("csv-mode"   :url nil)
  ("cycle-quotes"   :url nil)
  ("darkroom":url "https://github.com/capitaomorte/darkroom.git";)
@@ -160,6 +161,8 @@
  ("frame-tabs" :url nil)
  ("frog-menu"  :url "https://github.com/clemera/frog-menu";)
  ("fsm":url nil)
+ ("ftable" :url "https://github.com/casouri/ftable";
+  :auto-sync t)
  ("gcmh"   :url "https://gitlab.com/koral/gcmh";)
  ("ggtags" :url "https://github.com/leoliu/ggtags";)
  ("gited"  :url nil)



[elpa] scratch/javaimp-wip aa0f932: wip

2021-08-02 Thread Filipp Gunbin
branch: scratch/javaimp-wip
commit aa0f9324cddc5cb13f9f4239b52cf6182e13a7c1
Author: Filipp Gunbin 
Commit: Filipp Gunbin 

wip
---
 javaimp-parse.el | 51 +--
 javaimp-util.el  |  7 ---
 javaimp.el   | 21 ++---
 3 files changed, 43 insertions(+), 36 deletions(-)

diff --git a/javaimp-parse.el b/javaimp-parse.el
index ca8a77c..55c89f2 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -59,6 +59,10 @@ present."
 st)
   "Enables parsing angle brackets as lists")
 
+(defvar-local javaimp--parse-dirty-pos nil
+  "Buffer position after which all parsed information should be
+considered as stale.  Usually set by modification change hooks.")
+
 (defmacro javaimp--parse-with-arglist-syntax (beg &rest body)
   (declare (debug t))
   (let ((begin (make-symbol "begin")))
@@ -420,33 +424,34 @@ nil then goes all the way up.  Examines and sets property
 (setq tmp (cdr tmp
 res))
 
-
-;; Main
-
-(defun javaimp--parse-get-package ()
-  (goto-char (point-max))
-  (when (javaimp--parse-rsb-keyword
- "^\\s-*package\\s-+\\([^;\n]+\\)\\s-*;" nil t 1)
-(match-string 1)))
-
-
 (defun javaimp--parse-all-scopes ()
-  "Parses all scopes in a buffer."
+  "Parses all scopes in this buffer, but only after
+`javaimp--parse-dirty-pos' if it is non-nil."
+  (when javaimp--parse-dirty-pos
+(remove-text-properties javaimp--parse-dirty-pos (point-max)
+  '(javaimp-parse-scope nil)))
   (goto-char (point-max))
   (let ((parse-sexp-ignore-comments t)  ; FIXME remove with major mode
 (parse-sexp-lookup-properties nil))
-(while (javaimp--parse-rsb-keyword "{" nil t)
+(while (javaimp--parse-rsb-keyword "{" javaimp--parse-dirty-pos t)
   (save-excursion
 (forward-char)
 ;; Set props at this brace and all the way up
-(javaimp--parse-scopes nil)
+(javaimp--parse-scopes nil
+  (setq javaimp--parse-dirty-pos nil))
 
-(defun javaimp--parse-clean-all-scopes ()
-  (remove-text-properties (point-min) (point-max)
-  '(javaimp-parse-scope nil)))
 
+
+;; Functions intended to be called from other parts of javaimp.
+
+(defun javaimp--parse-get-package ()
+  (goto-char (point-max))
+  (when (javaimp--parse-rsb-keyword
+ "^\\s-*package\\s-+\\([^;\n]+\\)\\s-*;" nil t 1)
+(match-string 1)))
 
 (defun javaimp--parse-get-file-classes ()
+  (javaimp--parse-all-scopes)
   (goto-char (point-max))
   (let (match res)
 (while (setq match (text-property-search-backward
@@ -457,15 +462,19 @@ nil then goes all the way up.  Examines and sets property
  ".")
   res)
 
-(defun javaimp--parse-get-all-scopes()
+(defun javaimp--parse-get-all-scopes (&optional reparse)
+  (when reparse
+(setq javaimp--parse-dirty-pos (point-min)))
+  (javaimp--parse-all-scopes)
   (goto-char (point-max))
-  (let (res)
+  (let (match res)
 (while (setq match (text-property-search-backward
 'javaimp-parse-scope nil nil))
   (push (prop-match-value match) res))
 res))
 
 (defun javaimp--parse-get-forest-for-imenu ()
+  (javaimp--parse-all-scopes)
   (goto-char (point-max))
   (let (match methods classes top-classes)
 (while (setq match (text-property-search-backward
@@ -490,4 +499,10 @@ nil then goes all the way up.  Examines and sets property
   (equal el (javaimp-scope-parent tested)
  top-classes)))
 
+(defun javaimp--parse-update-dirty-pos (beg _end _old-len)
+  "Function to add to `after-change-functions' hook."
+  (when (or (not javaimp--parse-dirty-pos)
+(< beg javaimp--parse-dirty-pos))
+(setq javaimp--parse-dirty-pos beg)))
+
 (provide 'javaimp-parse)
diff --git a/javaimp-util.el b/javaimp-util.el
index 5e63c01..f2b4dda 100644
--- a/javaimp-util.el
+++ b/javaimp-util.el
@@ -187,7 +187,8 @@ PARENT-NODE is indented for recursive calls."
   tree)))
(apply #'seq-concatenate 'list
   (mapcar (lambda (child)
-(javaimp--collect-nodes-from-tree child predicate))
+(javaimp--collect-nodes-from-tree
+  child predicate unwrap))
   (javaimp-node-children tree))
 
 (defun javaimp--map-nodes (mapper forest &optional unwrap)
@@ -203,9 +204,9 @@ PARENT-NODE is indented for recursive calls."
   (make-javaimp-node
   :parent (javaimp-node-parent tree)
   :children (javaimp-node-children tree)
-  :contents mapped)))
+  :contents contents)))
   (mapcar (lambda (child)
-(javaimp--map-nodes-from-tree child mapper))
+(javaimp--map-nodes-from-tree child mapper unwrap))
   (javaimp-node-children tree)
 
 (defun javaimp--get-root (node)
diff --git a/javaimp.el b/j

[elpa] externals/pyim updated (ace9048 -> c2604a5)

2021-08-02 Thread ELPA Syncer
elpasync pushed a change to branch externals/pyim.

  from  ace9048   v3.9.3
   new  9ec925f   * pyim-pymap.el (pyim-pymap-py2cchar-cache-create): 
缓冲创建不全的问题的临时解决方案。
   new  c2604a5   v3.9.4


Summary of changes:
 pyim-pymap.el | 10 --
 pyim.el   |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)



[elpa] externals/pyim 9ec925f 1/2: * pyim-pymap.el (pyim-pymap-py2cchar-cache-create): 缓冲创建不全的问题的临时解决方案。

2021-08-02 Thread ELPA Syncer
branch: externals/pyim
commit 9ec925fb166ab2b02fccf9e34096e3050d7ba53d
Author: Feng Shu 
Commit: Feng Shu 

* pyim-pymap.el (pyim-pymap-py2cchar-cache-create): 缓冲创建不全的问题的临时解决方案。
---
 pyim-pymap.el | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pyim-pymap.el b/pyim-pymap.el
index f388f97..587e622 100644
--- a/pyim-pymap.el
+++ b/pyim-pymap.el
@@ -738,8 +738,14 @@
 
 用于加快搜索速度,这个函数将缓存保存到 `pyim-pymap-py2cchar-cache' 变量中,
 如果 FORCE 设置为 t, 强制更新索引。"
-  (when (or force (or (not pyim-pymap-py2cchar-cache1)
-  (not pyim-pymap-py2cchar-cache2)))
+  (when (or force
+(not pyim-pymap-py2cchar-cache1)
+(not pyim-pymap-py2cchar-cache2)
+;; FIXME: 我偶尔会遇到一个奇怪的问题,创建的缓存没有包含所有的汉字拼
+;; 音,原因未知,所以这里测试一下,看排在最后面的一个汉字拼音是否包
+;; 含在缓存中,如果不包含,就重新创建缓存。
+(and pyim-pymap-py2cchar-cache1
+ (not (gethash "zuo" pyim-pymap-py2cchar-cache1
 (setq pyim-pymap-py2cchar-cache1
   (make-hash-table :size 5 :test #'equal))
 (setq pyim-pymap-py2cchar-cache2



[elpa] externals/pyim c2604a5 2/2: v3.9.4

2021-08-02 Thread ELPA Syncer
branch: externals/pyim
commit c2604a549b26b7a2125f986e9d34f0b58353336d
Author: Feng Shu 
Commit: Feng Shu 

v3.9.4
---
 pyim.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyim.el b/pyim.el
index 19094ba..f0b096c 100644
--- a/pyim.el
+++ b/pyim.el
@@ -7,7 +7,7 @@
 ;; Feng Shu 
 ;; Maintainer: Feng Shu 
 ;; URL: https://github.com/tumashu/pyim
-;; Version: 3.9.3
+;; Version: 3.9.4
 ;; Keywords: convenience, Chinese, pinyin, input-method
 ;; Package-Requires: ((emacs "24.4") (async "1.6") (xr "1.13"))