emacs: Add and use 'guix-concat-strings'.
* emacs/guix-utils.el (guix-concat-strings): New function. * emacs/guix-pcomplete.el (guix-pcomplete-short-options): Use it. * emacs/guix-base.el (guix-get-package-strings): Likewise.
This commit is contained in:
		
							parent
							
								
									c10521e976
								
							
						
					
					
						commit
						1ce96dd927
					
				
					 3 changed files with 18 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -913,7 +913,7 @@ ENTRIES is a list of package entries to get info about packages."
 | 
			
		|||
                 (concat (guix-get-full-name entry)
 | 
			
		||||
                         (when outputs
 | 
			
		||||
                           (concat ":"
 | 
			
		||||
                                   (mapconcat #'identity outputs ",")))
 | 
			
		||||
                                   (guix-concat-strings outputs ",")))
 | 
			
		||||
                         (when location
 | 
			
		||||
                           (concat "\t(" location ")")))))))
 | 
			
		||||
         specs)))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -147,7 +147,7 @@ subcommands, actions, etc. for this guix COMMAND."
 | 
			
		|||
  "Return a string with available short options for guix COMMAND."
 | 
			
		||||
  guix-pcomplete-parse-short-option-regexp
 | 
			
		||||
  (lambda (list)
 | 
			
		||||
    (mapconcat #'identity list "")))
 | 
			
		||||
    (guix-concat-strings list "")))
 | 
			
		||||
 | 
			
		||||
(guix-memoized-defun guix-pcomplete-all-packages ()
 | 
			
		||||
  "Return a list of all available Guix packages."
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -128,6 +128,22 @@ split it into several short lines."
 | 
			
		|||
      (fill-region (point-min) (point-max)))
 | 
			
		||||
    (buffer-string)))
 | 
			
		||||
 | 
			
		||||
(defun guix-concat-strings (strings separator &optional location)
 | 
			
		||||
  "Return new string by concatenating STRINGS with SEPARATOR.
 | 
			
		||||
If LOCATION is a symbol `head', add another SEPARATOR to the
 | 
			
		||||
beginning of the returned string; if `tail' - add SEPARATOR to
 | 
			
		||||
the end of the string; if nil, do not add SEPARATOR; otherwise
 | 
			
		||||
add both to the end and to the beginning."
 | 
			
		||||
  (let ((str (mapconcat #'identity strings separator)))
 | 
			
		||||
    (cond ((null location)
 | 
			
		||||
           str)
 | 
			
		||||
          ((eq location 'head)
 | 
			
		||||
           (concat separator str))
 | 
			
		||||
          ((eq location 'tail)
 | 
			
		||||
           (concat str separator))
 | 
			
		||||
          (t
 | 
			
		||||
           (concat separator str separator)))))
 | 
			
		||||
 | 
			
		||||
(defun guix-completing-read-multiple (prompt table &optional predicate
 | 
			
		||||
                                      require-match initial-input
 | 
			
		||||
                                      hist def inherit-input-method)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue