以下是我的设置:
(defun my-sql-save-history-hook ()
(let ((lval 'sql-input-ring-file-name)
(rval 'sql-product))
(if (symbol-value rval)
(let ((filename
(concat "~/.emacs.d/sql/"
(symbol-name (symbol-value rval))
"-history.sql")))
(set (make-local-variable lval) filename)
(set-default 'sql-input-ring-file-name filename))
(error
(format "SQL history will not be saved because %s is nil"
(symbol-name rval))))))
我描述了变量值:
sql-input-ring-file-name's value is
"~/.emacs.d/sql/mysql-history.sql"
Original value was nil
Local in buffer *SQL*; global value is the same.
我有目录〜/ .emacs.d / sql,但没有任何文件
我的emacs版本是24.4.1
答案 0 :(得分:0)
我很难获得上述答案,但这对我有用。主要更改是library(stringr)
dat <-
list(c("BANK Percentage"),
c("JP MORGAN 16.93%"),
c("BNP PARIBAS 14.29%"),
c("JAPAN POST BANK 13.96%"),
c("Sumitomo Mitsui Banking 9.80%"),
c("Banco Santander 8.67%"),
c("Deutsche Bank 6.26%"),
c("CITIBANK 6.23%"),
c("Barclays Bank 4.84%"),
c("Royal Bank of Canada 4.38%"),
c("Postal Savings Bank of China Co Ltd 4.22%"))
portfolio <-
lapply(dat, str_split, "(\\s{2,}|\\s(?=[0-9]))", n = 2, simplify = TRUE)
portfolio <- do.call(rbind, portfolio)
portfolio
#> [,1] [,2]
#> [1,] "BANK" "Percentage"
#> [2,] "JP MORGAN" "16.93%"
#> [3,] "BNP PARIBAS" "14.29%"
#> [4,] "JAPAN POST BANK" "13.96%"
#> [5,] "Sumitomo Mitsui Banking" "9.80%"
#> [6,] "Banco Santander" "8.67%"
#> [7,] "Deutsche Bank" "6.26%"
#> [8,] "CITIBANK" "6.23%"
#> [9,] "Barclays Bank" "4.84%"
#> [10,] "Royal Bank of Canada" "4.38%"
#> [11,] "Postal Savings Bank of China Co Ltd" "4.22%"
和lval
kill-buffer-hook